2014-09-11 11:38:56 +01:00
|
|
|
# netstat
|
|
|
|
|
2024-04-18 05:04:00 +01:00
|
|
|
> Display network-related information such as open connections, open socket ports, etc.
|
2021-02-18 23:16:29 +00:00
|
|
|
> More information: <https://man7.org/linux/man-pages/man8/netstat.8.html>.
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- List all ports:
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
`netstat --all`
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- List all listening ports:
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
`netstat --listening`
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- List listening TCP ports:
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
`netstat --tcp`
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Display PID and program names:
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
`netstat --program`
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- List information continuously:
|
2014-09-11 11:38:56 +01:00
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
`netstat --continuous`
|
2016-01-14 13:52:25 +00:00
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
- List routes and do not resolve IP addresses to hostnames:
|
2016-01-14 13:52:25 +00:00
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
`netstat --route --numeric`
|
2016-01-29 14:26:33 +00:00
|
|
|
|
|
|
|
- List listening TCP and UDP ports (+ user and process if you're root):
|
|
|
|
|
2021-02-18 23:16:29 +00:00
|
|
|
`netstat --listening --program --numeric --tcp --udp --extend`
|