Netstat is a very important tool for gathering information about the connections on a machine or troubleshooting network problems. It’s a default utility for both Windows and Linux, thus there is no excuse in not getting familiar with it, it’s very useful for any system admin, network guy or good old home user that would like to know what really is coming and going to and from his computer.
If ran with no arguments, netstat produses an overwhelming output of all the open sockets in the system. Here is its man page description:
netstat – Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
Netstat is great when run with specific flags to zoom in on the information that is relevant to us. Here are some examples:
Display the PID and the name of the program to which eack socket belongs, along with the path
Display only listening sockets
Display all ports (both listening and non-listening
Display listening sockets and established connections
Display TCP ports and connections
Display TCP statistics
Display kernel routing tables
Display all TCP connections and listening ports using numeric values for addresses and ports, instead of resolving their names
Q: Why is Poland just like the United States? A: In the United States you can’t buy anything for zlotys and in Poland you can’t either, while in the U.S. you can get whatever you want for dollars, just as you can in Poland. — being told in Poland, 1987