How to view all open Ports on Linux
When referring to a network or to the Internet, software or network port is a location where information is sent. For example, port 80 is the http network port. A listing of commonly known and used ports can also be found on the below listing. Users running Microsoft Windows can utilize the netstat command to view currently active connections that include ports currently being used.
Users who want to block ports on their computer or network can use a software or hardware firewall. If you are unable to get access to a particular port it’s likely that a firewall is already present on the Network or other network settings set by the administrators have been setup.
Netstat: abbreviation of network statistics, the netstat command is a command found in almost all command-line environments that allow you to view the statistics of the network.
The netstat command shows the services listening to ports on a Linux server and the details of any connections currently made to them. The connection details to consider during basic network daemon troubleshooting are the addresses that the daemon is listening on (including the port number), the daemon’s process identifier (PID), and the program name.
You need to run netstat on the server that is running the service. Netstat is not affected by your firewall configuration.
To view all open ports on Linux, you can use below command:
ddos@ddos ~ $ sudo netstat -plntu
- -p, –programs display PID/Program name for sockets
- -l, –listening display listening server sockets
- -n, –numeric don’t resolve names
- -t|–tcp
- -u|–udp