Saturday, March 11, 2006

Netstat - Ports and Programs running

If you want to check the number of ports your system is listenning
to from foreign hosts and the programs used by it.

[root@mybox conf]# netstat -apln --inet

Active Internet connections (servers and established)

Example : This will list,

tcp------0------0--127.0.0.1:10026----0.0.0.0:* -----LISTEN---------4806/master

tcp------0------0--0.0.0.0:139-----------0.0.0.0:* -----LISTEN---------5008/smbd

tcp---0--0--10.10.93.220:1648--216.239.63.104:80--EST---7104/mozilla-firefox


Also Try,

#lsof -i

This will list:

-Running Commands
-User running the command
-PID of the Program
-Internet Protocol Version used- eg IPv4, IPv6
-Name of the Program