知道端口号、进程名称、进程ID中的任意一个,怎么查询其他信息?本文总结一下使用netstat对端口号、进程名称、进程ID进行互查。
netstat命令,全称是network statistics,即网络统计。
根据端口号,查询进程名称和进程ID
netstat -tunlp | grep 3306
根据进程名称,查询进程ID和端口号
netstat -tunlp | grep mysqld
根据进程ID,查询进程名称和端口号
netstat -tunlp | grep 29520
选项说明
netstat -tunlp
-t: 显示 TCP 连接
-u: 显示 UDP 连接
-n: 显示数字地址
-l: 列出状态是 LISTEN 的统计信息
-p: 显示程序的PID和名称