ss utility is a useful network status monitoring tool that is part of the
iproute2 package. The name
ss is an acronym for
socket statistics—represents, and is used for displaying all sorts of socket statistics such as TCP, UDP, and Unix Domain sockets.
As a Systems Administrator, these statistics will allow you to analyze and diagnose possible causes for network connectivity issues.
Compared to a more traditional tools such as
ss delivers results much faster, which can be very useful for network administrators who are managing servers with constant high traffic. This is why it is often recommended to use
ss instead of
- A CentOS 6.x x64 bit instance.
- A sudo user.
Install ss if necessary
ss command is available on most of the recently released Linux distributions. If it is not already installed on your system, you can install it along with some other utilities on RPM-based distribution using the following command:
sudo yum install iproute iproute-doc
Some examples of using ss
In this example, we will list some common examples of using
ss as a reference. You can learn more about
ss by passing the help parameter:
To show socket usage summary:
To show listening IPv4 sockets and their corresponding processes, using port numbers instead of service names:
The command above is the combination of the following
ss -l, and
ss -p. You can also combine other parameters in the same fashion.
Show IPv4 sockets:
To show port numbers instead of default service names:
Show listening sockets:
To show corresponding process names:
To show all sockets:
Similarly, you can list all TCP, UDP, RAW, or all Unix domain sockets accordingly using the following commands:
ss -at ss -au ss -ar ss -ax
To list the process responsible for opening port 22:
ss -lnp | grep 22
In this example, the
-n parameter and the port number 22 must be used at the same time, or you won’t be able to find the correct result.
Show sockets connected to a remote machine whose IP address is
ss dst 18.104.22.168
List all sockets matching the local IP address
22.214.171.124 and port
ss src 126.96.36.199:80
Show help for
This concludes our tutorial. Thank you for reading.
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article