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

相關文章
相關標籤/搜索