Big talk command-ss, big talk-ss
Big talk command-ss
Ss is short for Socket Statistics. As the name suggests, the ss command can be used to obtain socket statistics, which can display content similar to netstat.
Advantages:
(1) display more detailed information about TCP and connection status, (2) faster and more efficient than netstat.
1 format
Format: ss [option]… [Filter]
Netstat traverses proc to obtain socket information. ss uses netlink to communicate with the kernel tcp_diag module to obtain socket information.
2 Option
-T: tcp protocol
-U: udp protocol
-W: bare socket
-L: listen connection
-A: All
-N: digit format
-P: related program and PID
-E: Extended information
-M: memory usage
-O: timer Information
3. Instance
(1) ss-l displays all locally opened ports
[Root @ CentOS68 ~] # Ss-l
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 128 *: 60455 *:*
LISTEN 0 128: sunrpc :::*
LISTEN 0 128 *: sunrpc *:*
LISTEN 0 128: http :::*
LISTEN 0 128: ssh :::*
LISTEN 0 128 *: ssh *:*
LISTEN 0 128 127.0.0.1: ipp *:*
LISTEN 0 128: 1: ipp :::*
LISTEN 0 100: 1: smtp :::*
LISTEN 0 100 127.0.0.1: smtp *:*
LISTEN 0 128: 39546 :::*
[Root @ CentOS68 ~] #
(2) ss-pl displays the socket opened by each process
[Root @ CentOS68 ~] # Ss-pl
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 128 *: 60455 *: * users :( ("rpc. statd ))
LISTEN 0 128: sunrpc: * users :( ("rpcbind ))
LISTEN 0 128 *: sunrpc *: * users :( ("rpcbind", 1601,8 ))
LISTEN 0 128 *: ssh *: * users :( ("sshd ))
LISTEN 0 128 127.0.0.1: ipp *: * users :( ("cupsd", 1679,7 ))
LISTEN 0 128: 1: ipp: * users :( ("cupsd", 1679,6 ))
LISTEN 0 100: 1: smtp: * users :( ("master", 1955,13 ))
LISTEN 0 100 127.0.0.1: smtp *: * users :( ("master ))
LISTEN 0 128: 39546: * users :( ("rpc. statd ))
(3)-t-a displays all tcp sockets
[Root @ CentOS68 ~] # Ss-t-
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 128 *: 60455 *:*
LISTEN 0 128: sunrpc :::*
LISTEN 0 128 *: sunrpc *:*
LISTEN 0 128: http :::*
LISTEN 0 128: ssh :::*
LISTEN 0 128 *: ssh *:*
LISTEN 0 128 127.0.0.1: ipp *:*
LISTEN 0 128: 1: ipp :::*
LISTEN 0 100: 1: smtp :::*
LISTEN 0 100 127.0.0.1: smtp *:*
LISTEN 0 128: 39546 :::*
ESTAB 0 64 192.168.29.68: ssh 192.168.29.1: 50541
(4)-u-a displays all udp sockets
[Root @ CentOS68 ~] # Ss-u-
State Recv-Q Send-Q Local Address: Port Peer Address: Port
UNCONN 0 0 *: sunrpc *:*
UNCONN 0 0 *: 39797 *:*
UNCONN 0 0 *: ipp *:*
UNCONN 0 0 *: 928 *:*
UNCONN 0 0 *: bootpc *:*
UNCONN 0 0 127.0.0.1: 972 *:*
UNCONN 0 0: 59503 :::*
UNCONN 0 0 ::: sunrpc :::*
UNCONN 0 0: 928 :::*
(5) ss-o displays all established connections
[Root @ CentOS68 ~] # Ss-o
State Recv-Q Send-Q Local Address: Port Peer Address: Port
ESTAB 0 64 192.168.29.68: ssh 192.168.29.1: 50541 timer :( on, 442 ms, 0)