how to list and watch running TCP and UDP ports in real-time ?

In this short article, we will show you how to list and monitor or watch running TCP and UDP ports in real-time with a socket summary on a Linux system.

List All Open Ports in Linux
To list all open ports on a Linux system, you can use the netstat command or ss utility as follows.

It is also crucial to mention that netstat command has been deprecated and instead ss command has taken its place in showing more detailed network statistics.
$ sudo netstat -tulpn
OR
$ sudo ss -tulpn
List Open Ports in Linux
From the output of the above command, the State column shows whether a port is in a listening state (LISTEN) or not.

In the above command, the flag:

-t – enables listing of TCP ports.
-u – enables listing of UDP ports.
-l – prints only listening sockets.
-n – shows the port number.
-p – show process/program name.
Watch TCP and UDP Open Ports in Real-Time
However, to watch TCP and UDP ports in real-time, you can run the netstat or ss tool with the watch utility as shown.
$ sudo watch netstat -tulpn
OR$ sudo watch ss -tulpn
Watch Open Ports in Real Time in Linux
Watch Open Ports in Real Time in Linux

To exit, press Ctrl+C
Enjoy! Follow us for more...

No comments:

Post a Comment

How to Install files and the database in MAMP Server.mp4

  Download now   Enjoy! Follow us for more...