NETSTAT(8)
๐ NETSTAT(8) ๐
Okay bestie, this is the netstat(8) page from the Linux System Administrator's Manual ๐๐ It's your go-to for poking at the Linux networking subsystem ๐ฅ
โจ NAME โจ
netstat โ print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships ๐ฆ
โจ SYNOPSIS โจ
netstat [address_family_options] [--tcp|-t] [--udp|-u] [--udplite|-U]
[--sctp|-S] [--raw|-w] [--l2cap|-2] [--rfcomm|-f] [--listening|-l]
[--all|-a] [--numeric|-n] [--numeric-hosts] [--numeric-ports]
[--numeric-users] [--symbolic|-N] [--extend|-e[--extend|-e]]
[--timers|-o] [--program|-p] [--verbose|-v] [--continuous|-c]
[--wide|-W]
netstat {--route|-r} [address_family_options] [--extend|-e[--extend|-e]]
[--verbose|-v] [--numeric|-n] [--numeric-hosts] [--numeric-ports]
[--numeric-users] [--continuous|-c]
netstat {--interfaces|-i} [--all|-a] [--extend|-e[--extend|-e]]
[--verbose|-v] [--program|-p] [--numeric|-n] [--numeric-hosts]
[--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--groups|-g} [--numeric|-n] [--numeric-hosts] [--numeric-ports]
[--numeric-users] [--continuous|-c]
netstat {--masquerade|-M} [--extend|-e] [--numeric|-n] [--numeric-hosts]
[--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--statistics|-s} [--tcp|-t] [--udp|-u] [--udplite|-U]
[--sctp|-S] [--raw|-w]
netstat {--version|-V}
netstat {--help|-h}
address_family_options:
[-4|--inet] [-6|--inet6]
[--protocol={inet,inet6,unix,ipx,ax25,netrom,ddp,bluetooth, ... } ]
[--unix|-x] [--inet|--ip|--tcpip] [--ax25] [--x25] [--rose] [--ash]
[--bluetooth] [--ipx] [--netrom] [--ddp|--appletalk] [--econet|--ec]
โจ NOTES โจ
Okay so this program is mostly obsolete ๐ The replacement for netstat is ss, the replacement for netstat -r is ip route, the replacement for netstat -i is ip -s link, and the replacement for netstat -g is ip maddr ๐ซถ
โจ DESCRIPTION โจ
Netstat spills the tea on the Linux networking subsystem ๐ The first argument you give it decides what kind of info you get back โจ
๐ธ (none)
By default, netstat shows you a list of open sockets ๐ฆ If you don't name any address families, you'll get the active sockets from every configured address family ๐
--route,-rโ shows the kernel routing tables ๐บ๏ธ Check out route(8) for the full scoop. Fun fact:netstat -randroute -egive you the exact same output ๐--groups,-gโ shows multicast group membership info for IPv4 and IPv6 ๐--interfaces,-iโ shows a table of all your network interfaces ๐ฅ--masquerade,-Mโ shows a list of masqueraded connections ๐--statistics,-sโ shows summary stats for each protocol ๐
โจ OPTIONS โจ
--verbose,-vโ be extra chatty and tell you what's going on ๐ฃ๏ธ It especially prints some useful info about unconfigured address families ๐ง--wide,-Wโ don't chop off IP addresses; the output gets as wide as it needs to be ๐ฆ This is optional for now so existing scripts don't break ๐ซถ--numeric,-nโ show numerical addresses instead of trying to figure out symbolic host, port, or user names ๐ข--numeric-hostsโ shows numerical host addresses, but doesn't change how port or user names get resolved ๐--numeric-portsโ shows numerical port numbers, but doesn't change how host or user names get resolved ๐ธ--numeric-usersโ shows numerical user IDs, but doesn't change how host or port names get resolved ๐--protocol=family,-Aโ picks which address families (or maybe better called low-level protocols) you want connections shown for โจ family is a comma (,) separated list of keywords likeinet,inet6,unix,ipx,ax25,netrom,econet,ddp, andbluetooth๐ It does the same thing as using--inet|-4,--inet6|-6,--unix|-x,--ipx,--ax25,--netrom,--ddp, and--bluetooth๐ Theinetfamily (Iv4) covers raw, udp, udplite, and tcp protocol sockets ๐ฆ Thebluetoothfamily (Iv4) covers l2cap and rfcomm protocol sockets ๐ซง-c,--continuousโ makesnetstatprint the info you picked every single second, nonstop ๐-e,--extendโ shows additional info ๐ Use this twice if you want maximum detail ๐คฏ-o,--timersโ includes info about networking timers โฑ๏ธ-p,--programโ shows the PID and name of the program each socket belongs to ๐ง You'll see a hyphen if the socket belongs to the kernel (like a kernel service, or a process that exited while its socket still hasn't finished closing) ๐-l,--listeningโ shows only listening sockets ๐ These get left out by default, so this is how you find them ๐ซถ-a,--allโ shows both listening and non-listening sockets โจ When you use it with the--interfacesoption, it also shows interfaces that aren't up ๐-Fโ prints routing info from the FIB ๐ This one's the default ๐-Cโ prints routing info from the route cache ๐๏ธ
โ ๏ธ bestie, the original page lists-Fand-Cas routing info options, so make sure you pick the one you actually need before you go wild on the output ๐
โจ FILES โจ
/etc/servicesโ the services translation file ๐ง/procโ the mount point for the proc filesystem ๐ It's how you get into the kernel's status info, and it's guarded by these files:/proc/net/devโ device information ๐/proc/net/rawโ raw socket information ๐/proc/net/tcpโ TCP socket information ๐ฆ/proc/net/udpโ UDP socket information ๐ธ/proc/net/udpliteโ UDPLite socket information โจ/proc/net/igmpโ IGMP multicast information ๐ก/proc/net/unixโ Unix domain socket information ๐/proc/net/ipxโ IPX socket information ๐พ/proc/net/ax25โ AX25 socket information ๐ป/proc/net/appletalkโ DDP (appletalk) socket information ๐/proc/net/nrโ NET/ROM socket information ๐ฐ๏ธ/proc/net/routeโ IP routing information ๐บ๏ธ/proc/net/ax25_routeโ AX25 routing information ๐งญ/proc/net/ipx_routeโ IPX routing information ๐ฃ๏ธ/proc/net/nr_nodesโ the NET/ROM nodelist ๐/proc/net/nr_neighโ NET/ROM neighbours ๐ฏ/proc/net/ip_masqueradeโ masqueraded connections ๐ญ/proc/net/snmpโ statistics ๐
/sys/kernel/debug/bluetooth/l2capโ Bluetooth L2CAP information ๐ฉต/sys/kernel/debug/bluetooth/rfcommโ Bluetooth serial connections ๐ซง
โจ SEE ALSO โจ
Go check out route(8), ifconfig(8), iptables(8), proc(5), ss(8), and ip(8) ๐
They're the squad that pairs perfectly with this one.
โจ BUGS โจ
โ ๏ธ Okay, bestie, real talk: every now and then you might see strange info pop up if a socket changes while you're looking at it ๐ It's super unlikely though, so don't spiral.
โจ AUTHORS โจ
The netstat user interface was written by Fred Baumgarten <dc6iq@insu1.etec.uni-karlsruhe.de> ๐ The man page was basically done by Matt Welsh <mdw@tc.cornell.edu> ๐ Alan Cox <Alan.Cox@linux.org> gave it an update, and then Tuan Hoang <tqhoang@bigfoot.com> updated it again ๐
The man page and the command in the net-tools package got totally rewritten by Bernd Eckenfels <ecki@linux.de> ๐ฅ And UDPLite options were added by Brian Micek <bmicek@gmail.com> ๐
That's a wrap, bestie! ๐ฆ This was net-tools, last updated 2014-10-07, and you're officially a NETSTAT(8) legend now ๐๐ โจ
๐ฆ where this page comes from
- alpine 3.22: net-tools-doc 2.10-r3 ยท GPL-2.0-or-later
- alpine 3.23: net-tools-doc 2.10-r3 ยท GPL-2.0-or-later
- alpine 3.24: net-tools-doc 2.10-r3 ยท GPL-2.0-or-later
- arch rolling: net-tools 2.10-3 ยท GPL2
- debian bookworm: net-tools 2.10-0.1+deb12u2 ยท GPL-2.0-or-later
- debian trixie: net-tools 2.10-1.3 ยท GPL-2.0-or-later
- nixpkgs unstable: net-tools 2.10
- opensuse-leap 16.0: net-tools-deprecated 2.10-160000.4.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: net-tools-deprecated 2.10-160000.4.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: net-tools-deprecated 2.10-160000.4.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: net-tools-deprecated 2.10-160000.4.1 ยท GPL-2.0-or-later
- ubuntu noble: net-tools 2.10-0.1ubuntu4 ยท GPL-2.0-or-later
- ubuntu noble: net-tools 2.10-0.1ubuntu4.4 ยท GPL-2.0-or-later
- ubuntu questing: net-tools 2.10-1.3ubuntu2 ยท GPL-2.0-or-later
- ubuntu resolute: net-tools 2.10-2ubuntu1 ยท GPL-2.0-or-later
- ubuntu stonking: net-tools 2.10-2ubuntu1 ยท GPL-2.0-or-later
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms