Count connections by state

Show how many TCP connections are in ESTABLISHED, TIME_WAIT and other states.

ss -tan | awk 'NR>1{print $1}' | sort | uniq -c | sort -rn

tool
linux133 commands
tags
linuxnetworkmonitoring

More linux commands

  • mtr --report --tcp --port 443 example.com

    mtr combines traceroute and ping. TCP mode on port 443 gets through networks that block ICMP.

  • ping -M do -s 1472 -c 3 8.8.8.8

    Send 1500-byte packets with the DF bit set to find MTU problems on the path.

  • iptables -L -n -v --line-numbers

    Show all rules in the filter table with packet counters and line numbers.

  • nft list ruleset

    Print the full nftables ruleset in a readable form.

  • iperf3 -c <server_ip> -t 10 -P 4

    Measure TCP throughput with 4 parallel streams for 10 seconds.

all 133 linux commands