Here we are going to see how to Check the port used by any process in unix?

Check the port used by any process in unix?

Here is how you can check port used by any process in unix terminal.

While developing any webservice or web server you might end up using existing port number and will face issue while starting the server

Before such thing happens, better to check the port is being used by any process already to avoid such conflicts. Its saves us more time.

We have discussed below listed commands

  1. netstat – network utility used for checking the connection of TCP/UDP
  2. ss – Socket statistics, similar to netstat but faster.
  3. sudo – Run any command with root or super user level/mode.
https://youtu.be/kqVzUOZMSY0

netstat command

aryanz_co_in@pop-os:~/dev/folder1$ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN      5314/mysqld         
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      5314/mysqld         
udp        0      0 127.0.0.53:53           0.0.0.0:*                           4434/systemd-resolv

ss command

aryanz_co_in@pop-os:~/dev/folder1$ sudo ss -tulpn
Netid           State            Recv-Q           Send-Q                     Local Address:Port                       Peer Address:Port           Process                                                                                                                                           
udp             UNCONN           0                0                          127.0.0.53%lo:53                              0.0.0.0:*               users:(("systemd-resolve",pid=4434,fd=12))                                                                                                                                                                                                           
tcp             LISTEN           0                70                             127.0.0.1:33060                           0.0.0.0:*               users:(("mysqld",pid=5314,fd=32))                                                                                                                
tcp             LISTEN           0                151                            127.0.0.1:3306                            0.0.0.0:*               users:(("mysqld",pid=5314,fd=34))                                                                                                                                                                                  
Check the port used by any process in unix? - 3Minutes: Tutorial
~3Minutes: Tutorial

Please disable your adblocker or whitelist this site! We Provide Free content and in return, all we ask is to allow serving Ads.

Pin It on Pinterest

Share This
%d bloggers like this: