Linux server performance monitoring through the ‘ss’ command provides the monitoring statistics related to network sockets and connections. ‘ss’ stands for ‘Socket Statistics’ and it is a simpler and faster version of the obsolete command ‘netstat’. ‘ss’ utility completely replaces ‘netstat’ in the Linux Performance Monitoring system which provides more advanced features and flexibility. It has a wide range of options and filtering capabilities that allow you to customize the output to your needs. It is typically used to diagnose and troubleshoot network issues, such as identifying open ports, viewing established connections, and monitoring network traffic.
- Netid: It gives information about the type of socket like
- icmp6: Internet control message protocol
- nl: netlink
- tcp: transmission control protocol (connection-oriented)
- u_dgr: Unix datagram
- u_str: Unix stream
- u_seq: Unix sequence
- udp: user datagram protocol (connectionless)
- State: It provides the state of the socket. The possible values are ESTAB (Established), UNCONN (Unconnected), LISTEN (Listening), CLOSE-WAIT and TIME-WAIT.
- Recv-Q: It shows the number of received packets in the queue.
- Send-Q: It shows the number of sent packets in the queue.
- Local address:port: Address of local machine and port.
- Peer address:port: Address of remote machine and port.
- Process: It provides a process name; mostly blank response.
|It displays all sockets
|It shows the bpf filter socket information
|It displays only DCCP sockets
|It shows detailed socket information
|It continually displays sockets as they are destroyed
|It shows all the valid options for ‘ss’ command
|It shows internal TCP information
|It displays all the listening sockets
|It shows socket memory usage
|It displays only MPTCP sockets
|It displays the stats without resolving service names (IP Addresses)
|It shows timer information
|It shows the process used by a socket. Type, Process ID and fd.
|It shows the stats by resolving the host names.
|It shows the socket usage summary
|It displays only SCTP sockets
|It displays only TCP socket statistics.
|It displays only UDP sockets
|It displays only RAW sockets
|It displays only Unix domain sockets
|It displays process and socket SELinux security contexts
|It displays only IP version 4 sockets
|It displays only IP version 6 sockets
|It displays PACKET sockets
Commonly Used Combinations
|ss -t -a
|To display all TCP sockets
|ss -t -a -Z
|To display all TCP sockets with process SELinux security contexts
|ss -u -a
|To display all UDP sockets
|ss -a -A ‘all,!tcp’
|To list sockets in all states from all socket tables but TCP
|ss | wc -l
|To count the socket connections that are established on the system
You may be interested:
- Linux Performance Monitoring – vmstat
- Linux Performance Monitoring – mpstat
- Linux Performance Monitoring – iostat
- Performance Engineering Tutorial
- Important Linux Commands for Performance Testers
- Linux Operating System Performance Counters