shell编程_lsof命令

lsof -i:port | grep pid

例子:(根据端口号查看pid)

lsof -i:5432

[postgres@localhost ~]$ lsof -i:5432
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
postgres 4662 postgres    3u  IPv4  48819      0t0  TCP *:postgres (LISTEN)
postgres 4662 postgres    4u  IPv6  48820      0t0  TCP *:postgres (LISTEN)
postgres 9268 postgres    9u  IPv4  98826      0t0  TCP localhost:postgres->localhost:globmsgsvc (ESTABLISHED)
postgres 9269 postgres    9u  IPv4  98828      0t0  TCP localhost:postgres->localhost:pvsw (ESTABLISHED)

  

  

上一篇:CentOS 8 启用网卡与配置网卡固定 IP 等信息


下一篇:C# 如何获取本机IP