هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
ss (socket statistics) replaces the old netstat. The most used form is ss -tulpn: TCP and UDP, listening, with processes, as numbers.
You can filter by state (state established), port (sport = :22, dport = :443) and address (dst 192.168.122.0/24). Process names (-p) of other users are only shown to root.
طريقة الكتابة
ss [OPTION]... [FILTER]الخيارات 39
الأكثر استخدامًا
What to show
Details
Output
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 11
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Which ports are open?
ss -tulpn Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:* users:(("chronyd",pid=812,fd=5)) tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1010,fd=3)) tcp LISTEN 0 511 *:80 *:* users:(("httpd",pid=1420,fd=4))The most used form. 0.0.0.0 or * = all addresses; 127.0.0.1 = only local.
2Is my service listening?
ss -tlnp | grep ':80 'Nothing = the service did not start or listens on another port.
3Open SSH connections
ss -tn state established '( sport = :22 )'Who is connected to this server now.
4Connections to a remote port
ss -tn dst :443Outgoing HTTPS connections.
5Summary of all sockets
ss -sTotals; many TIME-WAIT can mean a busy web server.
6Connections from one network
ss -tn dst 192.168.122.0/24Filter by address.
7Find unknown listeners (security)
ss -tulpn | grep -vE ':(22|80|443|323)\b'Every open port should be known; a strange one can be a backdoor.
8Show the SELinux context of listeners
ss -tlnZHelps when SELinux blocks a service on a new port.
9Close a hanging connection
ss -K dst 192.168.122.99 dport = :8080Needs a kernel with socket destroy support.
10Watch new connections
watch -n1 'ss -tn state established | wc -l'Number of open connections every second.
11Unix sockets of a service
ss -xlp | grep podmanLocal sockets (like the podman or docker API).
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- Without root,
-pshows only your own processes. - A port in LISTEN is not reachable when the firewall blocks it. Check
firewall-cmd --list-all.
رموز الخروج
0 | Done. |
1 | Error. |