Check which ports are listening

Verify which ports are listening (open) using nmap

# nmap -sT -O localhost

Starting Nmap 6.47 ( ) at 2014-09-25 19:50 EDT
Nmap scan report for localhost (
Host is up (0.000076s latency).
Other addresses for localhost (not scanned):
rDNS record for localhost.localdomain
Not shown: 998 closed ports
111/tcp  open  rpcbind
3306/tcp open  mysql
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.7 - 3.15
Network Distance: 0 hops

OS detection performed. Please report any incorrect results at .
Nmap done: 1 IP address (1 host up) scanned in 1.79 seconds

If your system returns an unknown port (under Service) first check if your port is associated with a service in /etc/services

# cat /etc/services | grep <port_number>


# cat /etc/services | grep 3306
mysql            3306/tcp
mysql            3306/udp

If it isn't, use lsof or ss (the netstat successor)

#lsof -i | grep <port_number>
# ss | grep <port_number>

SS is also a good tool for showing the listening sockets:

# ss -ltn
State       Recv-Q Send-Q        Local Address:Port                Peer Address:Port 
LISTEN      0      128                 *:111                                          *:*     
LISTEN      0      128                 :::111                                         :::*     
LISTEN      0      128                :::3306                                       :::*