2024-08-26 11:55:58 +00:00
|
|
|
# 1. netstat
|
2024-08-25 15:21:39 +00:00
|
|
|
deprecated
|
|
|
|
|
2024-08-26 11:55:58 +00:00
|
|
|
# 2. ss
|
2024-08-25 15:21:39 +00:00
|
|
|
socket statistics
|
|
|
|
|
|
|
|
```shell
|
|
|
|
ss [options] [filter]
|
|
|
|
```
|
|
|
|
|
2024-08-26 11:55:58 +00:00
|
|
|
## 2.1. basic
|
2024-08-25 15:21:39 +00:00
|
|
|
listening 소켓을 제외하고 연결중인 모든 소켓 표시
|
|
|
|
```shell
|
|
|
|
ss
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
|
|
|
|
u_str ESTAB 0 0 @37ef18770354690f/bus/systemd/bus-system 9789 * 10972
|
|
|
|
u_str ESTAB 0 0 @855d8616477e9c56/bus/systemd-timesyn/bus-api-timesync 9317 * 6091
|
|
|
|
u_str ESTAB 0 0 @248f58c9224923fa/bus/systemd-resolve/bus-api-resolve 9316 * 6090
|
|
|
|
icmp6 UNCONN 0 0 *%enp1s0:ipv6-icmp *:*
|
|
|
|
tcp ESTAB 0 0 192.168.200.10:microsoft-ds 192.168.200.100:49576
|
|
|
|
tcp ESTAB 0 52 [::ffff:192.168.200.10]:ssh [::ffff:192.168.200.100]:49173
|
|
|
|
```
|
|
|
|
|
2024-08-26 11:55:58 +00:00
|
|
|
## 2.2. all
|
2024-08-25 15:21:39 +00:00
|
|
|
모든 소켓 표시
|
|
|
|
|
|
|
|
```shell
|
|
|
|
ss -a
|
|
|
|
```
|
|
|
|
|
2024-08-26 11:55:58 +00:00
|
|
|
## 2.3. numeric
|
2024-08-25 15:21:39 +00:00
|
|
|
서비스 이름 대신 숫자로 표기
|
|
|
|
|
|
|
|
```shell
|
|
|
|
ss
|
|
|
|
|
|
|
|
...
|
|
|
|
[::ffff:192.168.200.10]:ssh
|
|
|
|
```
|
|
|
|
|
|
|
|
```shell
|
|
|
|
ss -n
|
|
|
|
|
|
|
|
...
|
|
|
|
[::ffff:192.168.200.10]:22
|
|
|
|
```
|
|
|
|
|
2024-08-26 11:55:58 +00:00
|
|
|
## 2.4. process
|
2024-08-25 15:21:39 +00:00
|
|
|
관리자 권한 필요
|
|
|
|
|
|
|
|
```shell
|
|
|
|
ss -p
|
|
|
|
|
|
|
|
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
|
|
|
|
tcp ESTAB 0 36 [::ffff:192.168.200.10]:ssh [::ffff:192.168.200.100]:49173 users:(("sshd",pid=3277,fd=4),("sshd",pid=3160,fd=4))
|
|
|
|
```
|