Back to the command reference

ss

NetworkFundamentals In real Linux

Inspect sockets and listening ports

Name: ss = socket statistics

This command needs a real Linux system; you can practise it in real Linux mode.

Description

ss shows socket information and is the modern, faster and more detailed replacement for netstat. The favourite is ss -tulnp: all TCP and UDP listening ports with their processes.

Syntax

ss [OPTION]...

Common options

-t / -uTCP / UDP
-xUnix sockets (between local processes)
-lListening sockets only
-a / --allAll sockets, listening ones too
-nNumeric
-pShow processes
-s / --summaryOnly counts of each kind
-o / --optionsShow timers (how long a connection will be kept, say)
-4 / -6IPv4 / IPv6 only
state STATEFilter by state, e.g. ss -t state established

Examples

  • $ sudo ss -tulnp

    Which programs listen on which ports

    Explain
  • $ ss -tn state established

    Established TCP connections

    Explain

Related