LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ss

Display socket statistics and connections

TLDR

Show all TCP/UDP/RAW/UNIX sockets
$ ss -a -t
copy
Show all listening sockets
$ ss -l
copy
Show all TCP sockets with process information
$ ss -tp
copy
Show all TCP sockets connected to local HTTPS port
$ ss -t src :443
copy
Show all TCP sockets listening on port 8080
$ ss -lt src :8080
copy
Show established SSH connections
$ ss -o state established '( dport = :ssh or sport = :ssh )'
copy
Kill a socket connection
$ ss -K dst 192.168.1.1 dport = 22
copy
Print summary statistics
$ ss -s
copy

SYNOPSIS

ss [options] [FILTER]

DESCRIPTION

ss is used to dump socket statistics. It displays information similar to netstat but can show more TCP and state information than other tools. It retrieves socket information directly from kernel space, making it faster than netstat.

PARAMETERS

-h, --help

Show summary of options
-a, --all
Display both listening and non-listening sockets
-l, --listening
Display only listening sockets
-n, --numeric
Do not resolve service names; show numeric ports
-r, --resolve
Attempt to resolve numeric address/ports
-p, --processes
Show process using socket
-t, --tcp
Display TCP sockets
-u, --udp
Display UDP sockets
-x, --unix
Display Unix domain sockets
-w, --raw
Display raw sockets
-4, --ipv4
Display IPv4 sockets only
-6, --ipv6
Display IPv6 sockets only
-o, --options
Show timer information
-e, --extended
Show detailed socket information (UID, inode, cookie)
-m, --memory
Show socket memory usage
-i, --info
Show internal TCP information
-K, --kill
Forcibly close sockets
-s, --summary
Print summary statistics
-E, --events
Continually display sockets as they are destroyed
-N, --net=NSNAME
Switch to specified network namespace

INSTALL

sudo apt install iproute2
copy
sudo pacman -S iproute2
copy
sudo apk add iproute2-ss
copy
sudo zypper install iproute2
copy
brew install iproute2
copy
nix profile install nixpkgs#iproute2
copy

CAVEATS

State filtering supports TCP states (established, syn-sent, syn-recv, fin-wait-1, fin-wait-2, time-wait, closed, close-wait, last-ack, listening, closing) and meta-states (all, connected, synchronized, bucket). The -K option requires appropriate privileges.

HISTORY

ss is part of the iproute2 package and was developed as a modern replacement for netstat. It provides faster performance by reading directly from kernel netlink sockets rather than parsing /proc files.

SEE ALSO

ip(8), netstat(8), lsof(8)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid