Monitor Network Socket Connection Using 9 'ss' Command

The ss command is capable of showing details about network connections with more information than the netstat command and it is faster. Basically, SS utility is used to investigate sockets. It is used to dump socket statistics. ss displays statistics for TCP, UDP, UNIX and raw sockets. It can display more TCP and state information.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux Systems commands and its uses.

In this context, we shall look into common ss command in Linux, its uses and examples.

What is the ss command syntax ?

The command is simple to use. You can type ss with options and filters:

$ ss [options] [ FILTER ]

1. ss help

To get about command options and filter use:

$ ss --h

2. Man of ss command

You can get more about ss on it's manual page. Type following command:

$ man ss

3. View all TCP/UDP/UNIX socket connection

To view all types of connection with sent and received byte, source and destination just use ss command as below:

$ ss

4. Listing all listening tcp port

To list all listening address and services use -lt option:

$ ss -lt

To list all listening addresses and port use -ltn, here l is for listening, t for tcp and n for displaying port not service:

$ ss -ltn

5. View only UDP connection

To view UDP connections only use the -u option as shown below. -a display both listening and non-listening sockets:

$ ss -ua

6. View all TCP/UPD listening connection with username

This is the most important command. I also used it frequently. Here -t for tcp connection , u for UDP, l for listening, p for process using socket, a for all and n for listing port not service name.

This command will show the user, pid and source, destination for the connection:

$ sudo ss -tulpan | grep -i list

7. To see Memory utilized by the socket

Sometimes we may need to see which socket is using how much memory. For this, use ss command with the -m option as below:

$ ss -mt

8. List IPv4 and IPv6 sockets

To see all ip4 connections use -4 and for ipv6 use -6:

$ ss -4
$ ss -6

9. Display summary of socket connection

To display summary of socket connection just use -s option. It shows Total established, closed orphaned, time wait connection:

$ ss -s

[Need help in fixing Linux System errors? We can help you. ]


This article covers how to monitor socket connection using ss command. ss command is a tool that is used for displaying network socket related information on a Linux system. The tool displays more detailed information that the netstat command which is used for displaying active socket connections.

The basic ss command without any options simply lists all the connections regardless of the state they are in:

$ ss