CentOS Debian Mint openSUSE Red Hat Ubuntu

Monitor Network Socket Connection Using 10 ‘ss’ Command

SS utility is used to investigate sockets. It is used to dump socket statistics to show information like netstat command. ss displays statistics for TCP, UDP, UNIX and raw sockets. It can display more TCP and state information.

In this short article, I am going to show ss command uses and examples.

ss command syntax

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

$ ss [options] [ FILTER ]

ss help

To get about command options and filter use,

$ ss --h

Man of ss command

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

$ man ss

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

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

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

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.

In the following output, you can see user, pid and source, destination for the connection.

$ sudo ss -tulpan | grep -i list

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

List IPv4 and IPv6 sockets

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

$ ss -4

$ ss -6

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


You got an idea how to monitor socket connection using ss command. These commands are frequently used while running your system or applications. Thank you for getting here.

Similar Posts