Ss is part of the iproute2 package (control TCP / IP traffic and network tools). iproute2 goal is to replace the previous standard configuration for network interfaces, routing tables and ARP tables Unix network management tools (often referred to as "net-tools"). ss socket tool used to derive statistics, it can be displayed with netstat similar information, and can display more TCP and state information. Because it gets information directly from kernel space, it will be faster. ss operation and netstat like, so that it can be easy to replace netstat.
And the use of common options
ss and netstat like, has been established by default it will show an open connection to the list of non-listening TCP sockets. And you can use the following options to filter the output:
-n - Do not attempt to resolve the service name.
-r - to try to resolve numeric address / port.
-a - Displays all sockets.
-l - Display listening sockets.
-p - Display Use this socket's process.
-s - Print statistics
-t - show only TCP sockets.
-u - display only UDP sockets.
-d - displays only DCCP socket
-w - show only RAW sockets.
-x - display only Unix domain sockets
-f FAMILY - FAMILY display type socket. Currently supports the following family: unix, inet, inet6, link, netlink.
-A QUERY - the socket list to list, separated by commas. Recognizes the following identifiers: all, inet, tcp, udp, raw, unix, packet, netlink, unixdgram, unixstream, packetraw, packetdgram.
-o STATUS - Lists the specified socket is
ss command example
1. Display all the TCP port and use their processes:
# Ss -tnap
2. You can use the -4 flag to display IPv4 links, -6 flag to display IPv6 links, such as:
# Ss -tnap6
3. With the above behaviors, you just use u instead of t will show all open UDP port.
# Ss -unap
4. You can use the -s flag to print a variety of useful statistics:
# Ss -s
5. You can use the -o flag to check the links to all different states, for example, to display all connections have been established.
# Ss -tn -o state established -p