SS is part of the IPROUTE2 package (a tool that controls TCP/IP networks and traffic). The goal of Iproute2 is to replace the standard UNIX Network tool suite (commonly referred to as "Net-tools") previously used to configure network interfaces, routing tables, and administrative ARP tables. The SS tool is used to export socket statistics, which can display information similar to netstat, and can display more TCP and state information. Because it gets information directly from the kernel space, it is faster. SS operates like Netstat, so it makes it easy to replace Netstat.
Usage and common options
SS and Netstat are very similar, and by default it displays a list of open, non-listening TCP sockets that have established connections. And you can filter the output with the following options:
-N-Do not attempt to resolve the service name.
-R-Attempts to resolve the address/port of a number.
-A-displays all sockets.
-L-Displays a listening socket.
-P-Displays the process using this socket.
-S-Print statistical data
-T-displays only TCP sockets.
-U-Displays only UDP sockets.
-D-Show only DCCP sockets
-W-Displays only raw sockets.
-X-only UNIX domain sockets are displayed
-F FAMILY-Displays the type of FAMILY socket. Currently support the following families: Unix, inet, Inet6, Link, netlink.
-A QUERY-Specifies a list of sockets to list, separated by commas. The following identifiers can be identified: All, inet, TCP, UDP, Raw, UNIX, packet, NetLink, Unixdgram, Unixstream, Packetraw, Packetdgram.
-O Status-Lists the sockets for the specified state
SS Command Example
1. Display all of the TCP ports and the processes that use them:
The code is as follows:
# Ss-tnap
2. You can use the 4 logo to display IPv4 links,-6 logos to display IPv6 links, such as:
The code is as follows:
# SS-TNAP6
3. As with the above behavior, all you need to do is use u instead of T to display all the open UDP ports.
The code is as follows:
# Ss-unap
4. You can use the-s flag to print a variety of useful statistical data:
The code is as follows:
# ss-s
5. You can use the-O flag to check all links in different states, such as displaying all established connections.
The code is as follows:
# Ss-tn-o State Established-p