The Linux ss Command: Socket Statistics

The Linux ss Command: Socket Statistics

ss shows socket statistics - the modern replacement for netstat.


Basic Usage

ss

All sockets.

TCP

ss -t

TCP sockets only.

UDP

ss -u

UDP sockets only.

Listening

ss -l

Listening sockets.


Common Examples

All with process

ss -tulpn

TCP/UDP listening with process names.

Established connections

ss -tn | grep ESTAB

Active connections.

Specific port

ss -tn sport = :80

Port 80 connections.


Options

  • -t — TCP
  • -u — UDP
  • -l — Listening
  • -p — Process
  • -n — Numeric ports

Further Reading