Check what ports are open

To see what ports are open in your Linux box, you can use nmap port scanner or you can use netstat.

nmap can be used with following command:

# nmap -sS -O

The answer will be something like:

Starting Nmap 4.11 ( ) at 2010-07-08 11:31 CEST
Interesting ports on localhost.localdomain (
Not shown: 1663 closed ports
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
110/tcp  open  pop3
111/tcp  open  rpcbind
143/tcp  open  imap
993/tcp  open  imaps
995/tcp  open  pop3s
3306/tcp open  mysql
8009/tcp open  ajp13
8080/tcp open  http-proxy
8443/tcp open  https-alt
No exact OS matches for host (If you know what OS is running on it, see
Uptime 15.472 days (since Wed Jun 23 00:12:46 2010)
Nmap finished: 1 IP address (1 host up) scanned in 9.558 seconds

and nmap can be used to scan remote hosts (keep in mind that many admins will notice this as hack attempt). Simple replace with host IP address.

Another way to check open ports is via netstat. Netstat can show hidden ports and programs associated with ports. Simple execute next command as root:

# netstat -nap

The output list can be very long (depending from your network activity).

Note: Use this tips carefully. I’m not responsible for any potential damage…

Leave a Reply

Your email address will not be published. Required fields are marked *