• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

ss Command Examples in Linux

by admin

The ss (socket state) command is an information gathering utility similar to netstat but provides simpler output and syntax. The ss tool can provide information about established TCP connections or which ports the system may be listening on for inbound connections. This can help you diagnose problems related to clients and servers being unable to communicate with one another over the desired protocol; a missing socket could mean that the service isn’t running, and a closed socket could mean that either the client or the server is prematurely terminating the connection. Another way to use ss is to gather information about a particular client that may be connected.

Common options for the ss command include the following.

  • -l: Show currently listening sockets.
  • dst {host}: Show whether the specified host is connected and what the connection statistics are.
  • -i: Show only what ports are being listened on.

Syntax

The syntax of the ss command is:

# ss [options]

ss Command Examples

1. Show all TCP/UDP/RAW/UNIX sockets:

# ss -a -t|-u|-w|-x

2. Filter TCP sockets by states, only/exclude:

# ss state/exclude bucket/big/connected/synchronized/...

3. Show all TCP sockets connected to the local HTTPS port (443):

# ss -t src :443

4. Show all TCP sockets listening on the local 8080 port:

# ss -lt src :8080

5. Show all TCP sockets along with processes connected to a remote ssh port:

# ss -pt dst :ssh

6. Show all UDP sockets connected on specific source and destination ports:

# ss -u 'sport == :source_port and dport == :destination_port'

7. Show all TCP IPv4 sockets locally connected on the subnet 192.168.0.0/16:

# ss -4t src 192.168/16

Conclusion

The ss command is another utility used to view socket statistics, similar to the netstat command. The advantage of using ss is that it can display more TCP and connection state information than other tools that exist by default.

Filed Under: Linux

Some more articles you might also be interested in …

  1. sort Command Examples in Linux
  2. bb Command Examples (Native Clojure interpreter for scripting)
  3. kdig Command Examples
  4. CentOS / RHEL 6 : How to completely remove device mapper multipath (dm-multipath)
  5. How to Change the Default Shell In Linux
  6. Sample /etc/services file in Linux
  7. isosize: command not found
  8. indent Command Examples
  9. CentOS / RHEL 6 : How to password protect grub (Password-Protected Booting)
  10. adscript – Compiler for Adscript files (Command Examples)

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright