The netstat command is used to display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. To list all ports available on a server, including both TCP and UDP, along with the listening state and associated program names, the -tunlp options are used:
-t shows TCP ports.
-u shows UDP ports.
-n displays addresses and port numbers in numerical form.
-l shows only listening sockets.
-p shows the PID and name of the program to which each socket belongs.
Therefore, the command sudo netstat -tunlp effectively lists all ports available on a server with detailed information.
References:
EC-Council Certified Network Defender (CND) Study Guide
Linux netstat command documentation
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit