命令格式
ss [option] [filter]
option:
- -V:显示当前ss版本
- -n:不解析服务名字(默认端口号可能会被解析为服务的名字).例如不加n参数,80端口可能显示为http,22端口显示为ssh。
- -a 显示所有的连接
- -l 仅显示处于listen状态的socket
- -o 显示计时器信息,例如timer:(keepalive,24sec,0)
-m 显示端口socket内存占用,
r: represents the read (inbound) buffer
w represents the write (outbound) buffer
f represents the “forward allocated memory” (memory available to the socket)
t represents the transmit queue (stuff waiting to be sent or waiting on an ACK)-p:显示套接字进程信息,用户,程序等
- -4:仅显示ipv4套接字
- -6:仅显示ipv6套接字
- -t:仅显示tcp套接字
- -u:仅显示udp套接字
- -w:仅显示原始套接字
- -d:仅显示dccp套接字
- -x:仅显示unix套接字
- -f:显示family套接字,支持:unix,inet,inet6,link,netlink
ss state状态过滤
ss -ta state established ‘( dport = :http or sport = :http )’
ss src:过滤原地址,格式ip:port
- ss dst:过滤目的地址
- ss sport:源端口过滤,sport = xx
- ss dport:目的端口过滤