Reputation: 31
I have python sunning on my PC in a Linux machine .
ps -eaf | grep python
But now i dont know the process name say . Python is running on the port 7777. I only know the port no on which python with the bellow command .
netstat
Now i want to find out the pid no of python which is running on port 7777. as i dont know the process name i only know port no 7777 . are there any command for the same problem .
Upvotes: 0
Views: 551
Reputation: 6079
sudo netstat -tunlp | grep :7777
You can use either netstat
(deprecated) or ss
, with the same options which are mnemonic:
-t = TCP
-u = UDP
-n = numeric output
-l = listening ports
-p = pid
Another commands that works, apart, from lsof, is fuser (the Linux one because the BSD's is different).
sudo fuser -n tcp -n 7777
Upvotes: 0
Reputation: 237
You have to use following :
lsof -i :7777
I will show you pid without knowing the process name , but knowing the port no
Upvotes: 1