2019-03-12 04:36:28 +00:00
|
|
|
# netstat
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
> 显示与网络相关的信息,如打开的连接、打开的套接字端口等。
|
2021-10-01 19:28:01 +01:00
|
|
|
> 更多信息:<https://man7.org/linux/man-pages/man8/netstat.8.html>.
|
2019-03-12 04:36:28 +00:00
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 列出所有端口:
|
2019-03-12 04:36:28 +00:00
|
|
|
|
|
|
|
`netstat -a`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 列出所有被侦听端口:
|
2019-03-12 04:36:28 +00:00
|
|
|
|
|
|
|
`netstat -l`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 列出侦听的 TCP 端口:
|
2019-03-12 04:36:28 +00:00
|
|
|
|
|
|
|
`netstat -t`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 显示监听给定协议监听的 PID 和程序名:
|
2019-03-12 04:36:28 +00:00
|
|
|
|
2019-03-29 02:10:22 +00:00
|
|
|
`netstat -p {{协议}}`
|
2019-03-12 04:36:28 +00:00
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 打印路由表:
|
2019-03-12 04:36:28 +00:00
|
|
|
|
|
|
|
`netstat -nr`
|