• 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 Deepika

ss is a command-line utility used to investigate sockets in a Linux system. A socket is an endpoint for sending and receiving data across a network, and can be used by various network services and applications to communicate with each other.

The ss command provides an alternative to the netstat command, which is used to display information about network connections and routing tables. However, ss provides more detailed information about sockets and is generally faster and more efficient than netstat.

ss can be used to display a variety of information about sockets, including the state of the socket, the protocol used, the local and remote addresses, and the amount of data transmitted or received. The command also supports a wide range of filtering options, allowing users to selectively display sockets based on a variety of criteria, such as the socket state or the application that created the socket.

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

Summary

In summary, ss is a powerful and flexible tool for investigating sockets in a Linux system. It provides detailed information about sockets and supports a wide range of filtering options, making it a valuable tool for network troubleshooting and analysis.

Filed Under: Linux

Some more articles you might also be interested in …

  1. ipset Command Examples in Linux
  2. “az storage queue” Command Examples
  3. How to disable “sudo su” for users in sudoers configuration file
  4. mount: command not found
  5. nohup Command Options in Linux
  6. chars: Display names and codes for various ASCII and Unicode characters and code points
  7. CentOS / RHEL : How to remove used Physical Volume(PV) from Volume Group (VG) in LVM
  8. “git mv” Command Examples
  9. lpr: command not found
  10. LVM Snapshot: Backup and restore LVM Partition in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright