Wednesday, September 26, 2012

How to find if a port is in use on Linux/Unix

You can use the two below commands to figure out if a particular port is in use on a Unix/Linux box:
sudo netstat -tulpn | grep [port_number]
Or you can also use the following expanded command:
sudo netstat --all --programs --numeric-ports | grep [port_number]
If these commands return something, then the port is definitely in use. You could also use the above commands without sudo but then you might not get all the details of the process that is using the port.

No comments:


Related Posts Plugin for WordPress, Blogger...