Sobes.tech
Junior — Middle

What command line parameters are used with netstat and what are they for?

sobes.tech AI

Answer from AI

The netstat command is used to display network connections, routing tables, and interface statistics. Main command line options and their purposes:

  • -a — shows all connections and listening ports.
  • -t — displays only TCP connections.
  • -u — displays only UDP connections.
  • -n — shows addresses and ports in numeric form, without attempting to resolve names.
  • -l — shows only listening sockets.
  • -p — shows the PID and name of the process owning the socket (requires administrator privileges).
  • -r — displays the routing table.

Example usage:

netstat -tulnp

Will show all listening TCP and UDP ports along with the processes.