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
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
3. Listing Listening Sockets
To display only listening sockets, use the -l option as follows:
ss -l
or
sudo ss -l
4. Listing All TCP Connections
To display all TCP connections, use the -t option as follows:
ss -t
or
sudo ss -t
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
This article is excerpted from:
https://haduymusic.com/linux-basics/12-essential-linux-ss-commands-every-sysadmin-should-know/
Top comments (0)