USE NETSTAT TO VERIFY NETWORK CONNECTIONS

Being able to determine open ports on your system is an important part of any administrator's job. This will quickly tell you what services are available on your system, and whether any unauthorized services are listening on your computer.

While you can use a portscanner like nmap, the netstat tool offers a simpler approach. Netstat gives you loads of information about listening services on your system and is not limited to just TCP or UDP connections, which is what a portscanner looks for. In addition, netstat tells you what UNIX domain sockets are open and listening for connections.

To determine what Internet ports are open and listening for connections, execute the following command:

# netstat -lp --protocol=inet

This will return a list that contains the protocol, local address, foreign address, the state (in this case, we're looking for LISTEN), and the process ID and program name that's listening.

Change the end of the command to determine what UNIX domain sockets are open and listening for connections. For example:

# netstat -lp --protocol=unix

For a list of its many options, check out the netstat man page.

http://linux.ctyme.com/man/man1703.htm