14.8 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

Use the ss to display more socket connection information in Linux

Ss is an abbreviation for Socket Statistics. As the name suggests, the ss command can be used to get socket statistics, which can display something similar to netstat. The advantage of ss is that it can display more detailed information about TCP and connection status, and is faster and more efficient than netstat.

When the number of socket connections on the server becomes very large, either using the netstat command or directly cat /proc/net/tcp, the execution speed will be slow.

The secret of ss is that it uses tcp_diag in the TCP stack. Tcp_diag is a module for analyzing statistics, which can get the first-hand information in the Linux kernel, which ensures the fast and efficient ss.

Intsall ss

In case, you are unable to use ss command, use below command to install it.

- Advertisement -
 yum install iproute iproute-doc 

Now it is installed and ready to use.
Below are some useful commands to monitor network connections.

List all socket connections

The basic ss command, with no options, lists only all connections, no matter what state they are in.

ss

List only TCP Ports connections

To see all TCP socket connections, use the -lt option

ss -lt 

List only UDP Ports connections

To see all UDP socket connections, use the -ua option

ss -ua

Display socket PID (process ID)

To display the process ID associated with the socket connection, use the -p option

ss -p

Display summary statistics

To list summary statistics, use the -s option

ss -s

Filter connections by port number

The ss command also allows you to filter socket port Numbers or address Numbers

ss -at '( dport = :12598 or sport = :12598 )' 

Check the ss commands in the man page

For an in-depth understanding of the use of the ss command, use it to examine the man pages

man ss

These are some of the common options used with the ss command. This command is considered more advanced than the netstat command and provides detailed information about the network connection.

In conclusion:The ss command is a tool for displaying network socket-related information on a Linux system. The tool displays more details about the netstat command used to display active socket connections.

android Apache bionic Buster CentOS Centos 8 database Databases debian desktop fedora focal Focal Fossa google howto How to how to tutorials java Linux linux mint mariadb monitoring mysql network News New version opensuse PHP Programming RHEL Security server SQL tools Tutorial ubuntu unix web web server Windows Windows 10 windows 11 Windows server Windows server 2019 Xiaomi

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article