系统相关
首页 > 系统相关> > shell编程_lsof命令

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)

  

  

标签:shell,postgres,编程,TCP,IPv4,lsof,localhost,0t0
来源: https://www.cnblogs.com/Xiaoxiaogroup/p/15113203.html