Netstat

Updated: September 28, 2024

Display network information such as open connections, sockets and ports. For Macs us lsof instead.


Table of Contents

tldr

# list all ports
netstat --all

# list listening tcp ports
netstat --tcp

ARGUMENTS

netstat
    -a                  # show state of all sockets
    -l                  # print full IPv6
    -n                  # show network addresses as numbers
    -r                  # show routing tables
        -a              # show protocol cloned routes
        -s              # show routing stats instead
        -l-lll          # show more metrics
        -z              # display RTT and MTU values
    -q                  # show network interface send queue statistics, more info with -qq
    -c <queue>          # show stats for specific queue