Wednesday, August 23, 2017

Find out what process is listening on what port

Do you want to know what process is listening on a particular port in Linux?

Using the lsof command you can confirm that a java process with a pid of 14202 is listening on port 7001:
oracle@soahost1:/home/oracle> lsof -i :7001 | grep LISTEN 
java  14202 oracle 1013u  IPv6 3652361843  0t0  TCP soahost1:afs3-callback (LISTEN)

Similarly, using the netstat command, you can confirm that the java process with a pid of 14202 is listening on port 7001:
oracle@soahost1:/home/oracle> netstat -anp | grep LISTEN | grep 7001
tcp   0  0 ::ffff:10.31.160.230:7001   :::*   LISTEN   14202/java



No comments: