From 548c84e0e13eb3062ad37b1e282db2dc8224702e Mon Sep 17 00:00:00 2001 From: Julia Evans Date: Mon, 23 Feb 2026 17:06:11 -0500 Subject: [PATCH] man: netstat: add two examples Add an example of a couple of the most common was to use netstat. The goal is to help beginners or infrequent users of the tool remember the syntax. Mention that -n is very useful option. --- man/en_US/netstat.8 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/man/en_US/netstat.8 b/man/en_US/netstat.8 index 9a8d416..e4d04f4 100644 --- a/man/en_US/netstat.8 +++ b/man/en_US/netstat.8 @@ -545,6 +545,22 @@ which gives access to kernel status information via the following files. .I /proc/net/snmp -- statistics +.SH EXAMPLES +List all open TCP and UDP ports, with the corresponding process's PID. This lets you answer "which process is listening on port 8080?": +.RS +.nf +\fBnetstat -tulpn\fR +.fi +.RE + +.P +Show the route table (it's often best to pass -n to display IP addresses rather than hostnames): +.RS +.nf +\fBnetstat -rn\fR +.fi +.RE + .SH BUGS Occasionally strange information may appear if a socket changes as it is viewed. This is unlikely to occur.