What Is the ss Command in Linux?¶
Introduction¶
The ss command shows sockets, listening ports, and network connections. It is useful for beginners, Linux administrators, DevOps engineers, and RHCSA students because it solves practical terminal tasks.
What the Command Does¶
Use ss to work with the specific Linux object it manages. Before changing anything, identify the target and run a read-only check when possible.
Basic Syntax¶
ss OPTIONS
The syntax includes the command, any options, and the target object.
Common Options¶
-t: show TCP sockets.-u: show UDP sockets.-l: show listening sockets.
Practical Examples¶
ss -tuln
ss -tulpn
ss -tan state established
sudo ss -ltnp sport = :80
Verification command:
ss -s
Example output:
Total: 512
TCP: 18 (estab 4, closed 6, orphaned 0, timewait 6)
When to Use This Command¶
Use ss to find listening ports, active connections, and the process bound to a socket. It is the modern replacement for many netstat workflows.
Common Mistakes¶
- Forgetting sudo, which can hide process names.
- Confusing listening sockets with established connections.
- Looking only at ports and not checking the local address binding.
Quick Reference¶
ss -tuln
ss -tulpn
ss -s
Related Guides¶
Summary¶
The ss command is safest when you understand the target, choose the right option, and verify the result with a separate command.