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.
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.