2014-09-11 16:08:56 +05:30
|
|
|
# netstat
|
|
|
|
|
2024-04-18 06:04:00 +02:00
|
|
|
> Display network-related information such as open connections, open socket ports, etc.
|
2024-10-14 22:54:42 +03:00
|
|
|
> See also: `ss`.
|
2024-06-18 05:47:40 +02:00
|
|
|
> More information: <https://manned.org/netstat>.
|
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
|
|
|
|
2025-05-03 16:24:05 +01:00
|
|
|
`netstat {{[-a|--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
|
|
|
|
2025-05-03 16:24:05 +01:00
|
|
|
`netstat {{-l|--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
|
|
|
|
2025-05-03 16:24:05 +01:00
|
|
|
`netstat {{-t|--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
|
|
|
|
2025-05-03 16:24:05 +01:00
|
|
|
`netstat {{[-p|--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
|
|
|
|
2025-05-03 16:24:05 +01:00
|
|
|
`netstat {{[-c|--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
|
|
|
|
2025-05-03 16:24:05 +01:00
|
|
|
`netstat {{[-rn|--route --numeric]}}`
|
2016-01-29 14:26:33 +00:00
|
|
|
|
|
|
|
- List listening TCP and UDP ports (+ user and process if you're root):
|
|
|
|
|
2025-05-03 16:24:05 +01:00
|
|
|
`netstat {{[-tulpne|--tcp --udp --listening --program --numeric --extend]}}`
|