Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the ss command in Linux

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge of this article "how to use ss commands in Linux", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use ss commands in Linux" article.

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

Show all sockets with established connections

The ss command takes no options and displays a list of all sockets with established connections.

[root@localhost ~] # ss

Suppress the title line in the output

If you want to cancel the title line in the command output, you can use the-H option.

[root@localhost] # ss-H

Show only tcp connections

If you only want to display the tcp connection in the output of the command, you can use the-t option:

[root@localhost ~] # ss-t shows only udp connections

If you only want to display udp connections in the output of the command, you can use the-u option:

[root@localhost ~] # ss-u shows only unix connections

If you only want to display unix socket connections in the output of the command, you can use the-x option:

[root@localhost ~] # ss-x shows only the socket that is listening

If you want to display only the sockets being listened on, you can use the-l option.

[root@localhost ~] # ss-l displays summary information

Use the-s option to display summary information:

[root@localhost] # ss-sTotal: 156TCP: 3 (estab 1, closed 0, orphaned 0, timewait 0) Transport Total IP IPv6RAW 1 0 1 UDP 3 21 TCP 3 21 INET 7 4 3 FRAG 0 0 displays only IPv4/IPv6 sockets

If you only want to show ipv4 listeners, you can use the-4 and-l options.

[root@localhost] # ss-4l

If you only want to show ipv6 listeners, you can use the-6 and-l options.

[root@localhost ~] # ss-6l does not resolve IP addresses to hostnames

If you do not want to resolve ip addresses to host names, you can use the-n option to prevent commands from resolving IP addresses to host names. But this also prevents the resolution of the port number:

[root@localhost] # ss-n-4lNetid State Recv-Q Send-Q Local Address:Port Peer Address:Port udp UNCONN 00 192.168.43.131%ens160:68 0.0. 0.0 * udp UNCONN 0 0127.0.0.1VOR 323 0.0.0.0Vue * tcp LISTEN 0 128 0 .0.0.0: 22 0.0.0.0 * above is the content of this article on "how to use ss commands in Linux" I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report