2014-09-11 16:08:56 +05:30
|
|
|
# netstat
|
|
|
|
|
2018-11-21 10:30:05 +13:00
|
|
|
> Displays network-related information such as open connections, open socket ports, etc.
|
2021-02-18 20:16:29 -03:00
|
|
|
> More information: <https://man7.org/linux/man-pages/man8/netstat.8.html>.
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- List all ports:
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2021-02-18 20:16:29 -03:00
|
|
|
`netstat --all`
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- List all listening ports:
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2021-02-18 20:16:29 -03:00
|
|
|
`netstat --listening`
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- List listening TCP ports:
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2021-02-18 20:16:29 -03:00
|
|
|
`netstat --tcp`
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Display PID and program names:
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2021-02-18 20:16:29 -03:00
|
|
|
`netstat --program`
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- List information continuously:
|
2014-09-11 16:08:56 +05:30
|
|
|
|
2021-02-18 20:16:29 -03:00
|
|
|
`netstat --continuous`
|
2016-01-14 21:52:25 +08:00
|
|
|
|
2021-02-18 20:16:29 -03:00
|
|
|
- List routes and do not resolve IP addresses to hostnames:
|
2016-01-14 21:52:25 +08:00
|
|
|
|
2021-02-18 20:16:29 -03: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 20:16:29 -03:00
|
|
|
`netstat --listening --program --numeric --tcp --udp --extend`
|