Linux查看mq监听端口,Linux: Find Out Which Process Is Listening Upon a Port 查看是那个进程在占用哪个端口...

查看是那个进程在占用哪个端口,可以考虑使用:

netstat – a command-line tool that displays network connections, routing tables, and a number of network interface statistics.

fuser – a command line tool to identify processes using files or sockets.

lsof – a command line tool to list open files under Linux / UNIX to report a list of all open files and the processes that opened them.

/proc/$pid/ file system – Under Linux /proc includes a directory for each running process (including kernel processes) at /proc/PID, containing information about that process, notably including the processes name that opened port.

步骤1:

# netstat -tulpn

Sample outputs:

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1138/mysqld

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 850/portmap

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1607/apache2

tcp 0 0 0.0.0.0:55091 0.0.0.0:*

TCP port 3306 was opened by mysqld process having PID # 1138. You can verify this using /proc, enter:

# ls -l /proc/1138/exe

另外可以参考

On Linux, you must be root or the other user to get process information for processes running as other users, so prepending sudo is most of what you need. In addition to that, on modern Linux systems, ss is tool to use to do this:

$ sudo ss -lptn 'sport = :80'

State Local Address:Port Peer Address:Port

LISTEN 127.0.0.1:80 *:* users:(("nginx",pid=125004,fd=12))

LISTEN ::1:80 :::* users:(("nginx",pid=125004,fd=11))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值