Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.
TCP/IP command. Show network status. Print information on active sockets, routing tables, interfaces, masquerade connections, or multicast memberships. By default, netstat lists open sockets. When a delay is specified, netstat will print new information every delay seconds.
Options
The first five options (-g, -i, -M, -r, and -s) determine what kind of information netstat should display.
-g, --groups
Show multicast group memberships.
-i, --interface[=name]
Show all network interfaces, or just the interface specified by name.
-M, --masquerade
Show masqueraded connections.
-r, --route
Show kernel routing tables.
-s, --statistics
Show statistics for each protocol.
-a, --all
Show all entries.
-Afamily, --protocol=family
Show connections only for the specified address family. Accepted values are inet, unix, ipx, ax25, netrom, and ddp. Specify multiple families in a comma-separated list.
-c, --continuous
Display information continuously, refreshing once every second.
-C
Print routing information from the route cache.
-e, --extend
Increase level of detail in reports. Use twice for maximum detail.
-F
Print routing information from the forward information database (FIB). This is the default.
-l, --listening
Show only listening sockets.
-n, --numeric
Show network addresses, ports, and users as numbers.
--numeric-hosts
Show host addresses as numbers, but resolve others.
--numeric-ports
Show ports as numbers, but resolve others.
--numeric-users
Show user ID numbers for users, but resolve others.
-N, --symbolic
Where possible, print symbolic host, port, or usernames instead of numerical representations. This is the default behavior.
-o, --timers
Include information on network timers.
-p, --program
Show the process ID and name of the program owning the socket.