Skip to content
Home » Linux Unix » Which Process Listening to Specific Port

Which Process Listening to Specific Port

To check which process is listening to a specific port on Linux or AIX, we use commonly supported command netstat to know it:

  1. Check Port on Linux
  2. Check Port on AIX

Linux

We take port 5500 for an example on Linux platform.

Get Process ID

# netstat -nlp | grep ":5500" | grep LISTEN
tcp6       0      0 :::5500                 :::*                    LISTEN      1535/tnslsnr

We've found the process name which is using the port.

Get Process Name

# ps -ef | grep 1535 | grep -v grep
oracle      1535       1  0 21:42 ?        00:00:00 /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr LISTENER -inherit

As you can see, there's a database Oracle LISTENER listening to port 5500 for connections to Oracle Enterprise Manager Express (EM Express).

Basically, Oracle LISTENER listens only to port 1521 for database connections, but if EM express has been enabled, it listens to port 5500, too.

To stop listeners from listening to the port 5500, you can disable EM express, the listener will stop listening to the port at run-time. No restart is required.

AIX

We take port 6200 for an example on AIX platform. This time, the procedure is a little different.

Get Socket ID

# netstat -Aan | grep "\.6200" | grep LISTEN
f10010002b09d3b8 tcp        0      0  *.6200                *.*                   LISTEN

Get Process ID

# rmsock f10010002b09d3b8 tcpcb
The socket 0xf10010002b09d008 is being held by proccess 48890224 (ons).

Get Process Name

# ps -ef | grep 48890224 | grep -v grep
    grid 48890224 13697416   0   Feb 22      -  0:02 /u01/app/19.0.0/grid/opmn/bin/ons -d

As you can see, Oracle Notification Service (ONS) is listening to the port 6200. To stop ONS from listening to port 6200, we have some way to do it.

Leave a Reply

Your email address will not be published. Required fields are marked *