Pages

Tuesday, July 31, 2012

Linux: Which process is listening on a port?


Under various circumstances, like when starting up a server or a service, you may encounter "port already in use" error. Here are different ways to determine which process is using that port.
  • netstat -tulpn | grep <portNumber>
  • fuser <port#>/tcp
  • lsof -i tcp:<port#>

To determine if the commands are available on your system, try:
whereis <command>
e.g. whereis fuser

Once the pid is known for the process using the port, get information on the running process along with its command line:
ps -aux | grep <pid>

Reference

http://www.cyberciti.biz/faq/what-process-has-open-linux-port


No comments:

Post a Comment