DEV Community

tuanha
tuanha

Posted on

12 Essential Linux ‘ss’ Commands Every Sysadmin Should Know

I. Introduction

The Linux ss command is a powerful utility used to display detailed information regarding network sockets on a Linux system. It provides much deeper insights than the traditional netstat command, which is typically used just to view active socket connections.

II. Commonly Used Linux ss Commands
1. Listing All Connections
Running the basic ss command without any options will simply list all established connections, regardless of their current state.

ss
or
sudo ss
Enter fullscreen mode Exit fullscreen mode

2. Listing Listening and Non-listening Sockets
You can retrieve a complete list of both listening and non-listening sockets by using the -a option, as shown below.

ss -a
or
sudo ss -a
Enter fullscreen mode Exit fullscreen mode

3. Listing Listening Sockets
To display only listening sockets, use the -l option as follows:

ss -l
or
sudo ss -l
Enter fullscreen mode Exit fullscreen mode

4. Listing All TCP Connections
To display all TCP connections, use the -t option as follows:

ss -t
or
sudo ss -t
Enter fullscreen mode Exit fullscreen mode

5. Listing All Listening TCP Connections
To display all TCP connections that are in a listening state, use the combined -lt option as follows:

ss -lt
or
sudo ss -lt
Enter fullscreen mode Exit fullscreen mode

This article is excerpted from:
https://haduymusic.com/linux-basics/12-essential-linux-ss-commands-every-sysadmin-should-know/

Top comments (0)