Check Process That Use Certain Port

In Linux machine sometimes we need to check what process that runs on certain port. We can use the following command to do that (ex. we want to check the process runs on port 1521) :


oracle@mytestbed:~$ lsof -i :1521
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
oracle  2745 oracle   16u  IPv4 245996      0t0  TCP mytestbed:1911->mytestbed:1521 (SYN_SENT)
tnslsnr  2811 oracle    8u  IPv4 233815      0t0  TCP *:1521 (LISTEN)
oracle@mytestbed:~$

Alternatively we can use the following command :


oracle@mytestbed:~$ netstat -anp | grep 1521
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN      2811/tnslsnr
oracle@mytestbed:~$

Leave a Reply