It uses netstat to gather process ID for specific port (also lsof can be used) then checks the /proc/$PROCESS_ID/exe soft link to see where the process resides.
[root@VM1 bin]# ls -altr /proc/`netstat -natp | grep 80 | awk '{print $7}' | awk -F/ '{print $1}'`/exe
lrwxrwxrwx 1 root root 0 Nov 30 13:03 /proc/25316/exe -> /apache_test/bin/httpd
Tuesday, December 1, 2009
How to see the path of a process that's listening on specific port
From time to time you can have multiple instances of Apache installed on your server. As ps aux only shows the entire path, if you started the process using full path convention; you need to check /proc presudo file system to gather path information for the process. I generally use the below one liner to fetch this info :
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment