The netstat
command is a powerful networking tool that displays network connections, routing tables, interface statistics, and more. It helps users monitor network activity and troubleshoot network issues.
The basic syntax of the netstat
command is as follows:
netstat [options] [arguments]
Here are some common options you can use with netstat
:
-a
: Show all active connections and listening ports.-t
: Display TCP connections.-u
: Display UDP connections.-n
: Show numerical addresses instead of resolving hostnames.-l
: Show only listening sockets.-p
: Show the PID and name of the program to which each socket belongs.netstat -a
netstat -t
netstat -l
netstat -n
netstat -up
netstat -tunlp
will show TCP and UDP connections along with the program names.grep
to filter results. For instance, netstat -a | grep LISTEN
will show only listening connections.