Ports and processes in Ubuntu

This command will show what processes are currently listening on what ports on your Ubuntu box:

Result of netstat
The result of netstat

sudo netstat -lntp

If you have installed nmap (sudo apt-get install nmap), you could also run

sudo nmap -A -T4 localhost

Result of nmap
The result of nmap
to try and find out the name and version of the services running on each port.

The output of netstat above will give you the number of the process (pid) as well as the name. You can then use

sudo ps -f -p

to find out more about the process (for example the command line arguments passed to it) and this

sudo kill -9

to kill the process brutally (if you have no other means) and release the port in question.

Leave a comment

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


*