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 of Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

In this article, the editor introduces in detail "how to use the ss command of Linux". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to use the ss command of Linux" can help you solve your doubts.

Ss is the abbreviation of Socket Statistics. As the name implies, the ss command can be used to get socket statistics, which can display 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 is faster and more efficient 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 suppresses the header 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 shows 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.0purl * read here This article "how to use the ss command of Linux" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it. If you want to know more about the article, please follow 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