Find Out What Ports Are Listening / Open On My Linux & FreeBSD ServerTo find out what ports are listening or open on your Linux or FreeBSD server, you can use one of the following methods:
- Use the "netstat" command: "netstat" is a command-line utility that allows you to view the network connections and statistics of your system. To list all the listening ports on your server using "netstat", follow these steps:
2. Open a terminal and type the following command:
netstat -tulpn
- The output of the "netstat" command includes a list of active network connections and their respective details, such as the protocol, the local and remote addresses, and the status. For example:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 868/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 890/master
tcp6 0 0 :::22 :::* LISTEN 868/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 773/dhclient
udp 0 0 0.0.0.0:111 0.0.0.0:* 764/rpcbind
udp 0 0 0.0.0.0:631 0.0.0.0:* 887/cupsd
udp 0 0 0.0.0.0:12345 0.0.0.0:* 774/ntpd
udp 0 0 0.0.0.0:5353 0.0.0.0:* 774/ntpd
udp6 0 0 :::12345 :::* 774/ntpd
udp6 0 0 :::5353 :::* 774/ntpd
- The "Local Address" column shows the local IP address and port of the connection. The "Proto" column shows the protocol used by the connection (e.g., "tcp", "udp"). The