TECH SOLUTIONS

Click here to edit subtitle

Forums

Post Reply
Forum Home > Unix Learnings > How to check which process is running on a given port and how to make port free

Sourav Gulati
Site Owner
Posts: 83

'fuser' command can be used to check the pid of the process running on a given port

Systax:

fuser port_no/tcp

For example, following command is used to check the process running on port 50070

$ fuser 50070/tcp

50070/tcp:            9118

 

 

9118 is the pid of the process running on port 50070

To make a given port free you can kill the pid of the process running on a port. There is one more option, you can use "-k " option with fuser to do the same .

Syntax:

fuser -k port_no/tcp

For example:

$ fuser -k 50070/tcp

It will kill the process running on port 50070.


Note : A user can only kill the process on which it has  access  otherwise root user can help.



--


September 7, 2012 at 8:19 AM Flag Quote & Reply

You must login to post.