How can I check which ports and processes are running in Ubuntu

Before each work on the server, you need to check the connection to a particular port or debug. You should also check which ports are running and which process is running on which port. Sometimes you can also have problems like “port already in use” and if necessary you should know which process is using this port and terminate it if necessary. This can be achieved by knowing which ports are using different processes. This article will focus on showing you the ability to test ports and also all processes on your Ubuntu server.

There are several techniques for checking open ports and processes running on your Ubuntu. You can use netstat and grep commands

Grep & Netstat

The netstat command gives you the ability to display network status and protocol statistics on your server. Netstat displays different types of network data depending on the command line parameter used. TCP and UDP endpoints can be seen in tables, routing tables, and interface information formats. The Grep command parses the file and displays each line that contains this pattern for a specific character pattern.

In order to use the netstat command, you can enter the following command, which is listed below (check the http port):

netstat -ltnp | grep -w ': 80'

It is also possible to list all listening TCP or UDP ports, including those using ports and socket state. To do this, you need to enter a very simple but useful command such as:

netstat -tunlp

Using SS

The ss command is a special tool that is configured to use the display of network socket information on a Linux system. The tool displays more detailed information than the netstat command, which is used to display active socket connections.

Was this article helpful?

Related Articles

Leave A Comment?