Netstat Command: Uses & Options
The netstat command is used to display network connections, routing tables, and network interface information. It provides a way to monitor active network connections.
Run the netstat command using the following command format.
netstat [options]
Common options for the netstat command include:
- – Show the connections and listening ports for all activities.
- – Show only TCP connections.
- -u: Display only UDP connections.
- -n: display the address and port number in numerical form.
- -p: Displays the process/program associated with the connection.
- -r: Display the routing table.
- -s: display network statistics.
- Display only listening ports.
- -e: display additional information, such as Ethernet frames, MTU, etc.
- – c: Continuously display output.
Here are some common examples of the netstat command:
- Show all connections and listening ports for activities.
netstat -a
- Display only TCP connections.
netstat -t
- Show only UDP connections.
netstat -u
- Display the address and port number in numeric form.
netstat -n
- Display the processes/programs associated with the connection.
netstat -p
- Display routing table.
netstat -r
- Display network statistics.
netstat -s
Here are some common options and examples for the netstat command. You can choose the appropriate options based on your specific needs when using the netstat command.