1

When I encounter "a server is already running" I use below command to solve this issue

lsof -wni tcp:3000" 
kill -9 pid

I undertand lsof, but don't understand why "-wni", does anybody know what "-wni" stands for?

Also I could use lsof -i tcp:3000, but what is the difference between lsof -i tcp:3000 and lsof -wni tcp:3000?

Thanks.

Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
Marcfly7
  • 13
  • 5
  • `lsof -wni tcp:3000` is a shortcut for `lsof -w -n -i tcp:3000`. Find an lsof documentation to find out the meaning of the options w, n, and i. Maybe ther is a documentation on your system, try `info lsof` or `man lsof`. – miracle173 Jan 13 '17 at 06:13
  • Thanks Miracle, I understand now. Appreciate your help. – Marcfly7 Jan 13 '17 at 13:42

1 Answers1

0

You can run man lsof to find out those flags.

-w Enables (+) or disables (-) the suppression of warning messages.

-n inhibits the conversion of network numbers to host names for network files. Inhibiting conversion may make lsof run faster. It is also useful when host name lookup is not working properly.

-i [i] selects the listing of files any of whose Internet address matches the address specified in i. If no address is specified, this option selects the listing of all Internet and x.25 (HP-UX) network files.

Edmund Lee
  • 2,514
  • 20
  • 29