linux查看端口号占用

1、lsof -i:端口号

2、netstat -tunlp|grep 端口号

都可以查看指定端口被哪个进程占用的情况

【步骤一】lsof -i

lsof -i 用以显示符合条件的进程情况,lsof(list open files)是一个列出当前系统打开文件的工具。以root用户来执行lsof -i命令,如下图

【步骤二】lsof -i:端口号

lsof -i:端口号,用于查看某一端口的占用情况,比如查看22号端口使用情况,lsof -i:22,如下图

【步骤三】netstat -tunlp

netstat -tunlp用于显示tcp,udp的端口和进程等相关情况,如下图

扫描二维码关注公众号,回复: 7115621 查看本文章

【步骤四】netstat -tunlp|grep 端口号

netstat -tunlp|grep 端口号,用于查看指定端口号的进程情况,如查看22端口的情况,netstat -tunlp|grep 22,如下图

猜你喜欢

转载自www.cnblogs.com/accpguoliang/p/11421633.html
今日推荐