← 返回命令列表

Linux command

ss 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

ss -a -t

Example

ss -l

Example

ss -tp

Example

ss -t src :443

Example

ss -lt src :8080

Example

ss -o state established '( dport = :ssh or sport = :ssh )'

Kill

ss -K dst 192.168.1.1 dport = 22

Example

ss -s

说明

ss is used to dump socket statistics. It displays information similar to netstat but can show more TCP and state information than other tools. It retrieves socket information directly from kernel space, making it faster than netstat.

参数

-h, --help
Show summary of options
-a, --all
Display both listening and non-listening sockets
-l, --listening
Display only listening sockets
-n, --numeric
Do not resolve service names; show numeric ports
-r, --resolve
Attempt to resolve numeric address/ports
-p, --processes
Show process using socket
-t, --tcp
Display TCP sockets
-u, --udp
Display UDP sockets
-x, --unix
Display Unix domain sockets
-w, --raw
Display raw sockets
-4, --ipv4
Display IPv4 sockets only
-6, --ipv6
Display IPv6 sockets only
-o, --options
Show timer information
-e, --extended
Show detailed socket information (UID, inode, cookie)
-m, --memory
Show socket memory usage
-i, --info
Show internal TCP information
-K, --kill
Forcibly close sockets
-s, --summary
Print summary statistics
-E, --events
Continually display sockets as they are destroyed
-N, --net=NSNAME
Switch to specified network namespace

FAQ

What is the ss command used for?

ss is used to dump socket statistics. It displays information similar to netstat but can show more TCP and state information than other tools. It retrieves socket information directly from kernel space, making it faster than netstat.

How do I run a basic ss example?

Run `ss -a -t` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -h, --help do in ss?

Show summary of options