0

I'm trying to close some CLOSE_WAIT localhost processes, and so am trying to get their process id's using 'netstat -anp'.

I've seen multiple posts recommending this, however, everytime I enter this command into terminal, i get this man page message:

netstat: option requires an argument -- p
Usage:  netstat [-AaLlnW] [-f address_family | -p protocol]
netstat [-gilns] [-f address_family]
netstat -i | -I interface [-w wait] [-abdgRt]
netstat -s [-s] [-f address_family | -p protocol] [-w wait]
netstat -i | -I interface -s [-f address_family | -p protocol]
netstat -m [-m]
netstat -r [-Aaln] [-f address_family]
netstat -rs [-s]

I don't know what the problem is.

bgenchel
  • 3,739
  • 4
  • 19
  • 28

1 Answers1

3

Are you using linux? or any other BSD version such as OS X?

In Linux, -p references to process id (PID - the you are expecting) while in OS X (maybe in free/open BSD too, but can't confirm it) -p references to a protocol and need it to be specified.

Regarding the output you are posting, this seems to be the problem, you can use instead: (maybe you would change the port range, I put the whole line as an example)

lsof -i tcp:1-1024 -P |grep CLOSE_WAIT
ignivs
  • 636
  • 7
  • 18