Identify network issues with SS command in Linux (with examples)

3 min readJul 7, 2021


SS command in Linux is used to get various network/socket connection-related information from a Linux system. Previously we had used the Netstat command to perform the same operations but it has been long deprecated & was replaced with the ss command in Linux.

SS command is much faster than netstat & capable of showing much more information than netstat. Those familiar with the Netstat command need not worry as the options used with the ss command are similar to netstat.

In this tutorial, we will learn the usage of the SS command with the help of SS command examples.

(Recommended Read: Learn to use Wget command with 12 examples)

(Also Read: Check Linux filesystem for errors: FSCK command with examples)

SS command examples in Linux

1- Checking all connections

To list out all the connections on a system, we can use the ‘a’ option with ss command,

$ ss -a

This will produce all tcp, udp & Unix connections from the system.

2- Checking all tcp or udp or Unix socket connections

To list only the tcp connections in our system, use ‘t’ options with ss,

$ ss -at

Similarly to list out only the udp connections on our system, we can use the ‘u’ option with ss,

$ ss -au

To only list out Unix socket connections, we can use the ‘x’ option,

$ ss -ax

3- List process id/Process Name with

To get the list of all connections along with PID or process name, we can use the ‘p’ option & it can be used in combination with any other ss option,

$ ss -ap

4- List only port number & not the name

To speed up our output, we can use the ’n’ option as it will perform any reverse lookup & produce output with only numbers. Since no lookup is performed, our output will much faster.

$ ss -an

5- Print only listening ports

To print only the listening ports, we will use the ‘l’ option with ss. It will not be used with ‘a’ as it prints all ports,

$ ss -l

6- Print network stats

To print network statistics of each protocol like packet received or transmitted, we can use ‘s’ options with ss,

$ ss -s

7- Print interfaces stats

To display only the statistics on network interfaces, use the ‘I’ option,

$ ss -i

8- Display the network routing information

To print the network routing information, use the ‘r’ option,

$ ss -r

9- Filtering a single port

To filter a single port connection, we can combine the ‘grep’ command with ss,

$ ss -anp | grep 3306

10- Count the number of connections

To count the number of connections from the port, we can further add the ‘wc’ command with ss & grep command,

$ ss -anp | grep 3306 | wc -l

This will print the number of connections for the port mysql port i.e. 3306.

With this, we end our tutorial on how to use the SS command in Linux with the help of some examples. Please let know if you want us to add some more ss command examples or have any other suggestion or query using the comment box below.

We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,

DigitalOcean — 100$ free credit & Linode — 100$ free credit

Check some Exclusive Deals, HERE.

Also, check out DevOps Book You should read section.



LinuxTechLab is a beginner friendly website where you can learn Linux Tips & tricks,Scripting, also has lots of tutorials aimed at making Linux easy.