
When you don’t want the name of the host, port or user to be displayed, use netstat -n option. Don’t resolve host, port and user name in netstat output Administrators often want to pick out specific connections based on protocols or port numbers for example. The above command shows all connections from different protocols like tcp, udp and unix sockets. This means that the foreign or remote machine has already closed the connection, but that the local program somehow hasn’t followed suit. The stranger among these is the “CLOSE WAIT” state. The TCP protocol defines states, including “LISTEN” (wait for some external computer to contact us) and “ESTABLISHED” (ready for communication). State – tells in which state the listed sockets are. The local end is always on the computer on which you’re running netstat and the foreign end is about the other computer Local Address & Foreign Address – tell to which hosts and ports the listed sockets are connected.

In short: if this is 0, everything’s ok, if there are non-zero values anywhere, there may be trouble. Recv-Q & Send-Q – tell us how much data is in the queue for that socket, waiting to be read (Recv-Q) or sent (Send-Q). UDP connections are used by certain fast-paced computer games and sometimes by live streams. TCP connections are used for browsing the web and downloading files. Proto – tell us if the socket listed is TCP or UDP. Output contain multiple pages, so some data are omitted. Simply run the netstat command with the a option.Ĭheck the following snippet for the netstat output. The first and most simple command is to list out all the current connections. netstat is one of the most basic network service debugging tools, telling you what ports are open and whether any programs are listening on ports. It is very useful in terms of network troubleshooting and performance measurement. Netstat is available on all Unix-like Operating Systems and also available on Windows OS as well. It lists out all the tcp, udp socket connections and the unix socket connections. It can be used to list out all the network (socket) connections on a system. But everything is not lost.Netstat (network statistics) is a command line tool for monitoring network connections both incoming and outgoing as well as viewing routing tables, interface statistics, masquerade connections, multicast memberships etc. There seems to be no way to get the same kind of info using netstat on Mac OS X. Also there is no -t parameter but it can be done using -ptcp. Actually on Mac OS X, the -p parameter of netstat doesn’t mean program or process but protocol. Somehow I’ve only noticed now that netstat on Mac OS X cannot show the program name. -p: show the program name / PID owning the socket.I want to see the ports and the programs listening on these ports.

When checking the listening ports on my Linux machine I put netstat some pants on: # netstat -pant | grep LISTEN
