It is available on Unix, Plan 9, Inferno, and Unix-like operating systems including macOS, Linux, Solaris and BSD.
On macOS, BSD systems, Linux distributions, and Microsoft Windows: To display the statistics for only the TCP or UDP protocols, type one of the following commands: netstat -sp tcpnetstat -sp udpOn Unix-like systems: To display all ports open by a process with id pid: netstat -aop | grep "pid"To continuously display open TCP and UDP connections numerically and also which program is using them on Linux: netstat -nutpacwOn Microsoft Windows: To display active TCP connections and the process IDs every 5 seconds, type the following command (works on NT based systems only, or Windows 2000 with hotfix): netstat -o 5To display active TCP connections and the process IDs using numerical form, type the following command (works on NT based systems only, or Windows 2000 with hotfix): netstat -noNetstat uses an asterisk * as a wildcard which means "any".
[citation needed] On the Windows platform, netstat information can be retrieved by calling the GetTcpTable and GetUdpTable functions in the IP Helper API, or IPHLPAPI.DLL.
In addition to the command-line netstat.exe tool that ships with Windows, GUI-based netstat programs are available.
On macOS, the /System/Library/CoreServices/Applications folder (or /Applications/Utilities in OS X Mountain Lion and earlier) contains a network GUI utility called Network Utility, the Netstat tab of which runs the netstat command and displays its output in the tab.