Displaying Socket Information

List All Sockets:

To obtain a comprehensive list of all active sockets on your system, use the following command:

ss

ss

When you execute this command, it provides a detailed list of established connections. This information includes the protocol type (e.g., TCP, UDP, RAW), local and foreign addresses, the state of each connection, and more.

Filtering by Protocol:

You can narrow down the socket list by specifying a particular protocol. For instance, if you want to view only TCP sockets, use the -t option like this:

ss -t

This command displays only TCP sockets, making it easier to focus on a specific type of connection.

Display Listening Sockets:

To see all sockets currently in the listening state (sockets waiting for incoming connections), employ the -l option:

ss -l

ss -l

This command helps you identify which services or applications are actively listening for incoming network connections.

Display Established Connections:

If you’re interested in viewing exclusively established connections (sockets that are actively communicating), use the -e option:

ss -e

ss -e

This command provides a concise list of connections that are currently established, omitting listening or other states.

ss command in linux

Linux is celebrated for its versatility and robust command-line utilities. One such utility is the ‘ss’ command, which stands for “Socket Statistics.” It is a potent tool for inspecting and displaying detailed information about network sockets on a Linux system. The ‘ss’ command is an indispensable resource for network administrators, system administrators, and developers, offering insights into network connections, routing tables, and more.

In this comprehensive guide, we’ll explore the ‘ss’ command, its various options, and use cases, and provide real-world examples to help you harness its full potential.

Similar Reads

Basic Syntax of `ss` command in Linux

Before diving into the intricacies of ‘ss,’ let’s start with its basic syntax:...

Options Available in the `ss` command Linux

We will go through the most common options available....

Displaying Socket Information:

List All Sockets:...

Advanced Filtering and Display Options:

The ‘ss’ command offers more advanced options for filtering and customizing the displayed socket information....

Real-World Examples:

Example 1: Display TCP Connections to Port 22 (SSH):...

Conclusion:

The ‘ss’ command is a valuable tool for examining network sockets and connections on a Linux system. Its flexibility and numerous options make it suitable for a wide range of tasks, from troubleshooting network issues to monitoring network activity....