As Linux users, we sometimes need to know which port number a particular process is listening upon. All ports are associated with a process ID or service in an OS. So how do we find that port? This article presents three different methods for you to find which port number a process is listening on.
We have run the commands and procedures described in this article on an Ubuntu 18.04 LTS system.
Method 1: Using the netstat command
Netstat or the network statistics utility is used to view information related to the network connections. This includes information about interface statistics, routing tables and much more. This utility is available on most Linux systems so let us make use of it to view information about which ports certain processes are using on the system.
For using the netstat command, you need to install the net-tools utility if it is already not installed on your system through the following command:
$ sudo apt install net-tools
Read more at Vitux