find the ports listening ports or open ports in Linux machine
by RameshKumar[ Edit ] 2008-05-28 14:54:15
The following command says which ports are listening for TCP connections from the network:
nmap -sT localhost
The output will look like
Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2008-05-28 15:22 IST
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1648 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
25/tcp open smtp
53/tcp open domain
80/tcp open http
111/tcp open rpcbind
113/tcp open auth
139/tcp open netbios-ssn
443/tcp open https
445/tcp open microsoft-ds
953/tcp open rndc
3306/tcp open mysql
Nmap run completed -- 1 IP address (1 host up) scanned in 0.270 seconds
You can say sitename or machine IP instead of localhost
For example::
nmap -sT yoursite
this will print the open ports of the machine.