How to find process running on port Ubuntu? Check Linux open ports by process; How to check process running on port 8080 in Linux.
Using netstat
The netstat command is a member of the net-tools package. netstat (network statistics) command is used to display information about network.
If the command is not installed upon the system, install it using the command $ sudo apt-get install net-tools and once installed use it to check port and process information.
$ sudo netstat -ltnup
The netstat command uses the following command parameters to diplay the related netwrok information:
- l: display only listening sockets
- t: display tcp connection
- n: display addresses in a numerical form
- u: show UDP connections
- p: display process ID/ Program name
Find Which Process Is Running On A Specific Port Number
Run the following command to find which process is running on specific port number. For example the following command will display which process is running on port number 80 on the system:
$ sudo netstat -ltnp | grep -w ':80'
Using the lsof Command
You can use the lsof (List of Open Files) command to listen all the open files on your Linux Ubuntu system. If it is not installed, run the command given below to install lsof:
$ sudo apt install lsof
Once installed, This command will list all processes using TCP port number 80 on teh system:
$ sudo lsof -i :80
NOTE: On Linux Ubuntu systems, only the root user or the process owner can get/see the detailed information of the process.
Using fusrer
The fuser utility displays which processes are using named files, sockets, or file systems. It’s included in the psmisc package and preinstalled on many modern Linux distributions by default.
It is most widely used to get the information of the process running on a specific port.
For example the command given bwlow will show the PID of the processing listening TCP port 22:
$ sudo fuser 22/tcp
If you want more details about the process run the command with the “-v” option. It show verbose output.