State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:http *:*
users:(("nginx",2591,6),("nginx",15272,6))
LISTEN 0 10 127.0.0.1:15770 *:*
users:(("aegis_quartz",16616,8))
LISTEN 0 128 *:22 *:*
users:(("sshd",24244,3))
```
**查看所有socket连接**
$ ss -a
1
2
3
4
5
6
7
* 如果只想查看TCP sockets, 那么使用 `-ta` 选项
* 如果只想查看UDP sockets, 那么使用 `-ua` 选项
* 如果只想查看RAW sockets, 那么使用 `-wa` 选项
* 如果只想查看UNIX sockets, 那么使用 `-xa` 选项
#### 附录
#####ss命令参数列表
-h, --help
Show summary of options.
-V, --version
Output version information.
-n, --numeric
Do now try to resolve service names.
-r, --resolve
Try to resolve numeric address/ports.
-a, --all
Display all sockets.
-l, --listening
Display listening sockets.
-o, --options
Show timer information.
-e, --extended
Show detailed socket information
-m, --memory
Show socket memory usage.
-p, --processes
Show process using socket.
-i, --info
Show internal TCP information.
-s, --summary
Print summary statistics. This option does not parse socket lists obtaining summary from various sources.
It is useful when amount of sockets is so huge that parsing /proc/net/tcp is painful.
-4, --ipv4
Display only IP version 4 sockets (alias for -f inet).
-6, --ipv6
Display only IP version 6 sockets (alias for -f inet6).
-0, --packet
Display PACKET sockets.
-t, --tcp
Display only TCP sockets.