netstat

netstat is a network tool that allows you to view and analyze network connections and routing tables. It can display various statistics about network connections, such as the protocol, local and remote addresses, ports, and more. The netstat command is used for troubleshooting network issues, detecting potential security threats, and monitoring network performance.

Basic Syntax

netstat [options]

Commonly Used Options

  • -a: This displays all active network connections, including listening ports.
  • -n: This displays network addresses as numbers instead of names.
  • -p: This displays the process ID (PID) and name of the program that is using the connection.
  • -r: This displays the routing table for the current system.
  • -s: This displays summary statistics for each protocol.
  • -t: This displays all active TCP connections.
  • -u: This displays all active UDP connections.

Useful Examples

  • netstat -a: This displays all active network connections, including listening ports.
  • netstat -an: This displays all active network connections with IP addresses and port numbers.
  • netstat -ap: This displays all active network connections with the process ID and name of the program that is using the connection.
  • netstat -rn: This displays the routing table for the current system.
  • netstat -s: This displays summary statistics for each protocol.
  • netstat -t: This displays all active TCP connections.
  • netstat -u: This displays all active UDP connections.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments

  1. […] Once installed, let’s first allow TCP traffic over your SSH port so that you don’t get locked out of…

  2. […] have the option to choose between Password and SSH key selection. Learn more about SSH keys here. It’s recommended…