From Linuxintro

nmap allows you to find out what network ports are open on your system:

itchy:~ # nmap localhost

Starting Nmap 4.75 ( http://nmap.org ) at 2009-04-06 23:38 EDT
Warning: Hostname localhost resolves to 2 IPs. Using
Interesting ports on localhost (
Not shown: 996 closed ports
22/tcp  open  ssh
25/tcp  open  smtp
111/tcp open  rpcbind
631/tcp open  ipp

Nmap done: 1 IP address (1 host up) scanned in 0.28 seconds

Scan all ports

nmap -sS -O -PI -PT

To scan all ports -p 1-65535

See also