linux下进程、端口号相互查看方法

linux下进程、端口号相互查看方法 linux下经过进程名查看其占用端口: 一、先查看进程pid ps -ef | grep 进程名linux

二、经过pid查看占用端口 netstat -nap | grep 进程pidnginx

例:经过nginx进程查看对应的端口号tcp

#查看nginx进程pid: 命令: ps -ef | grep nginx 结果: root 9836 1 0 Jul11 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx nobody 9841 9836 0 Jul11 ? 00:00:09 nginx: worker process进程

#经过nginx进程pid查看占用端口(进程pid为9836) 命令: netstat -nap | grep 9836 结果: tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 9836/nginx
tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 9836/nginx
tcp 0 0 0.0.0.0:8082 0.0.0.0:* LISTEN 9836/nginx
tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 9836/nginxast

linux经过端口查看进程: netstat -nap | grep 端口号grep

-p 显示端口进程方法

例:查看8081号端口对应的进程名端口

命令: netstat -nap | grep 8081 结果: tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 9836/nginxprocess

相关文章
相关标签/搜索