Search code examples
linuxunixnetstat

Find pid of a process while its rinning on background


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 .


Solution

  • You have to use following :

    lsof -i :7777
    

    I will show you pid without knowing the process name , but knowing the port no