Linux下进程及端口查询汇总

根据端口查进程

lsof -i:port
netstat -nap | grep port

根据进程号查端口

lsof -i | grep pid
netstat -nap | grep pid

根据进程名查找pid、port

ps -ef | grep tomcat
ps -ef | grep pid

netstat无法显示PID或进程名

$ netstat -nap | grep 8080
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::8080                 :::*                    LISTEN      -                   

执行netstat -anop后得到如上结果,有些端口占用没有进程的pid和Program Name,使用root执行即可

上一篇 Windows下php.ini关键配置
下一篇 shell脚本报错:/bin/bash^M bad interpreter No such file or directory
目录
文章列表
1 Android架构之MVC、MVP、MVVM
Android架构之MVC、MVP、MVVM
2
Arthas Spring Boot Starter
Arthas Spring Boot Starter
3
K8s节点删除
K8s节点删除
4
AWS Auto Scaling Group 操作
AWS Auto Scaling Group 操作
5
MySQL 正则表达式
MySQL 正则表达式
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。