Search This Blog

2009-04-02

Find process listen on specific port

During various enterprise application installation, such as SAP NetWeaver, Oracle Application Server, etc, it is common to see server log complain about network port allocated, or the log show nothing, while daemon hang during start up. This post will show whether a particular process is using the port.

Run following command as root, or sudo
lsof -i :80
Where port 80 is Apache web server port. Following is sample output
COMMAND   PID     USER   FD   TYPE   DEVICE SIZE NODE NAME
apache2 10437 root 3u IPv6 22890556 TCP *:www (LISTEN)
apache2 10438 www-data 3u IPv6 22890556 TCP *:www (LISTEN)
apache2 10439 www-data 3u IPv6 22890556 TCP *:www (LISTEN)
apache2 10440 www-data 3u IPv6 22890556 TCP *:www (LISTEN)
apache2 10441 www-data 3u IPv6 22890556 TCP *:www (LISTEN)
apache2 10442 www-data 3u IPv6 22890556 TCP *:www (LISTEN)
apache2 25966 www-data 3u IPv6 22890556 TCP *:www (LISTEN)
apache2 25968 www-data 3u IPv6 22890556 TCP *:www (LISTEN)

No comments: