Address in use – how to check

We usually hit with error “Address in use” while starting processes that does TCP/IP connections. To investigate such errors we have few commands that are very handy in Linux

netstat

Run the netstat command with tulnp option to get the active process that is using the port. This command will have to be run with sudo / root access.

$ sudo netstat -tulnp  
 Active Internet connections (only servers)
 Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
 tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      587/sshd            
 tcp6       0      0 :::80                   :::*                    LISTEN      388/apache2         
 tcp6       0      0 :::22                   :::*                    LISTEN      587/sshd            
 udp        0      0 0.0.0.0:68              0.0.0.0:*                           292/dhclient        
 udp        0      0 127.0.0.1:323           0.0.0.0:*                           372/chronyd         
 udp6       0      0 ::1:323                 :::*                                372/chronyd 
$ sudo netstat -tulnp | grep 80
tcp6 0 0 :::80 :::* LISTEN 388/apache2

0 Comments on Address in use – how to check

Leave a Comment

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

You Might Be Interested In