A Linux system administrator needs to know some Linux tricks. In this article, we present the tutorial watch TCP and UDP ports in Real-time. A port is a logical construct that identifies a specific process/application or a type of network service and each network service running on a Linux system uses a particular protocol. TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).
Tutorial watch TCP and UDP ports in Real-time
Join us to see 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
You can use the netstat command or ss utility, to list all open ports on a Linux system. In addition, the netstat command has been deprecated, and instead, ss command has taken its place in showing more detailed network statistics.
sudo netstat -tulpn sudo ss -tulpn
The output will show by the state column whether a port is in a listening state (LISTEN) or not.
And 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
You can run the netstat or ss tool with the watch utility to watch TCP and UDP ports in real-time.
sudo watch netstat -tulpn sudo watch ss -tulpn
It’s all done. You can press CTLR+C to exit.
Dear user, we hope you would enjoy this tutorial watch TCP and UDP ports in Real-time, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problems in it.