Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Netstat

August 26, 2023 — Gregg Szumowski

My most frequently used netstat command with parameters for checking port (active internet) connections is:

$ netstat -tulpn

You can also pipe the output to grep to filter for specific ports or addresses.

Here is a brief listing of some of the many options:

$ netstat [options]

Option Action
-a Display the state of all sockets, not just the active.
-c Continuously display information, updating every second.
-i Include network device statistics.
-n Display all network addresses as numbers.
-o Display additional information.
-r Display routing tables.
-t Display only the TCP sockets.
-u Display only the UDP sockets.
-v Print the netstat version number and exit.
-w List only the raw sockets.
-x Display only the Unix sockets.

Tags: cli, networking, netstat, motd