在Ubuntu找出開啟服務的程式
Step1)檢查電腦process對應的port
#sudo netstat -nap
jian@jian:/etc/supervisor/conf.d$ sudo netstat -nap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:42087 0.0.0.0:* LISTEN 806/containerd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1235/mysqld
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 985/redis-server 12
tcp 0 0 127.0.0.1:9998 0.0.0.0:* LISTEN 1691/python3
tcp 0 0 203.68.236.9:9999 0.0.0.0:* LISTEN 1691/python3
tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 1691/python3
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1054/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 755/systemd-resolve
Step2)查詢pid對應的程式
(1)ps aux |grep 指定的pid
#ps aux |grep 1691
root 1691 0.0 1.0 625068 83900 ? Sl 10:02 0:34 /home/gogo/bin/python3 manage.py runbridged
(2)#lsof -p 1691
python3 1691 root cwd DIR 253,0 4096 3942337 /home/jian/site
python3 1691 root rtd DIR 253,0 4096 2 /
python3 1691 root txt REG 253,0 5465880 393476 /usr/bin/python3.8