linux 显示当前端口,显示linux操作系统当前打开的端口(port)

参考自:

https://access.redhat.com/solutions/1987

How do I list the open ports on my system and the process that owns them?

使用lsof -i命令即可:

[root@abc ~]# lsof -i

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

rpcbind 1644 rpc 6u IPv4 11565 0t0 UDP *:sunrpc

rpcbind 1644 rpc 7u IPv4 11567 0t0 UDP *:971

rpcbind 1644 rpc 8u IPv4 11568 0t0 TCP *:sunrpc (LISTEN)

rpcbind 1644 rpc 9u IPv6 11570 0t0 UDP *:sunrpc

rpcbind 1644 rpc 10u IPv6 11572 0t0 UDP *:971

rpcbind 1644 rpc 11u IPv6 11573 0t0 TCP *:sunrpc (LISTEN)

rpc.statd 1701 rpcuser 7u IPv4 11839 0t0 UDP *:48976

rpc.statd 1701 rpcuser 8u IPv4 11843 0t0 TCP *:63124 (LISTEN)

rpc.statd 1701 rpcuser 9u IPv6 11847 0t0 UDP *:48394

rpc.statd 1701 rpcuser 10u IPv6 11851 0t0 TCP *:57162 (LISTEN)

rpc.statd 1701 rpcuser 59u IPv4 11834 0t0 UDP localhost:659

cupsd 1746 root 6u IPv6 12130 0t0 TCP localhost:ipp (LISTEN)

cupsd 1746 root 7u IPv4 12131 0t0 TCP localhost:ipp (LISTEN)

cupsd 1746 root 9u IPv4 12134 0t0 UDP *:ipp

sshd 1937 root 3u IPv4 12699 0t0 TCP *:ssh (LISTEN)

sshd 1937 root 4u IPv6 12701 0t0 TCP *:ssh (LISTEN)

master 2016 root 12u IPv4 12911 0t0 TCP localhost:smtp (LISTEN)

master 2016 root 13u IPv6 12913 0t0 TCP localhost:smtp (LISTEN)

postgres 2072 highgo432 3u IPv4 13145 0t0 TCP *:postgres (LISTEN)

postgres 2072 highgo432 4u IPv6 13146 0t0 TCP *:postgres (LISTEN)

postgres 2072 highgo432 8u IPv6 13161 0t0 UDP localhost:59722->localhost:59722

postgres 2074 highgo432 8u IPv6 13161 0t0 UDP localhost:59722->localhost:59722

postgres 2075 highgo432 8u IPv6 13161 0t0 UDP localhost:59722->localhost:59722

postgres 2076 highgo432 8u IPv6 13161 0t0 UDP localhost:59722->localhost:59722

postgres 2077 highgo432 8u IPv6 13161 0t0 UDP localhost:59722->localhost:59722

postgres 2078 highgo432 8u IPv6 13161 0t0 UDP localhost:59722->localhost:59722

postgres 4877 highgo475 3u IPv4 18837 0t0 TCP *:5899 (LISTEN)

postgres 4877 highgo475 4u IPv6 18838 0t0 TCP *:5899 (LISTEN)

postgres 4877 highgo475 8u IPv6 18853 0t0 UDP localhost:60657->localhost:60657

postgres 4879 highgo475 8u IPv6 18853 0t0 UDP localhost:60657->localhost:60657

postgres 4880 highgo475 8u IPv6 18853 0t0 UDP localhost:60657->localhost:60657

postgres 4881 highgo475 8u IPv6 18853 0t0 UDP localhost:60657->localhost:60657

postgres 4882 highgo475 8u IPv6 18853 0t0 UDP localhost:60657->localhost:60657

postgres 4883 highgo475 8u IPv6 18853 0t0 UDP localhost:60657->localhost:60657

sshd 14619 root 3r IPv4 46824 0t0 TCP abc:ssh->192.168.80.1:64586 (ESTABLISHED)

[root@abc ~]#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值