Netstat: Difference between revisions
Jump to navigation
Jump to search
(→-a) |
(→Mac) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
* http://en.wikipedia.org/wiki/Netstat | * http://en.wikipedia.org/wiki/Netstat | ||
=Internal= | |||
* [[Windows netstat]] | |||
=Installation= | =Installation= | ||
Line 11: | Line 15: | ||
=Finding out what processes are listening and on what sockets= | =Finding out what processes are listening and on what sockets= | ||
==Linux== | |||
netstat -nl --program | |||
netstat -nl --program | |||
The --program option will list the PID/process path. | The --program option will list the PID/process path. | ||
==Mac== | |||
netstat -n | grep LISTEN | |||
[[lsof]] -nP -i4TCP:$PORT | grep LISTEN | |||
=Scan Open Ports and Shut Down Services= | =Scan Open Ports and Shut Down Services= | ||
Line 38: | Line 48: | ||
==-a== | ==-a== | ||
Show the state of all sockets; normally sockets used by server processes are not shown. With the routing table display (option -r), show protocol-cloned routes (routes generated by a RTF_PRCLONING parent route); normally these routes are not shown. |
Latest revision as of 00:17, 4 October 2019
External
Internal
Installation
yum install net-tools
Finding out what processes are listening and on what sockets
Linux
netstat -nl --program
The --program option will list the PID/process path.
Mac
netstat -n | grep LISTEN
lsof -nP -i4TCP:$PORT | grep LISTEN
Scan Open Ports and Shut Down Services
netstat -tulpn
Options
-n
Show numerical addresses instead of trying to determine symbolic host, port or user names.
-l
Show only listening sockets (these are omitted by default).
-p
Show the PID and name of the program to which each socket belongs.
-a
Show the state of all sockets; normally sockets used by server processes are not shown. With the routing table display (option -r), show protocol-cloned routes (routes generated by a RTF_PRCLONING parent route); normally these routes are not shown.