ss Command Examples in Linux¶
Introduction¶
These examples show practical ways to use ss on a Linux terminal. Each example is written so you can adapt it for administration or troubleshooting.
Example 1: Basic Usage¶
ss -tuln
This is the simplest form of the command and is a good starting point before adding options.
Example 2: Common Admin Task¶
ss -tulpn
This example reflects a common task on RHEL, Rocky Linux, AlmaLinux, or similar systems.
Example 3: Useful Option¶
ss -tan state established
This option helps narrow the result, change behavior, or handle a more realistic target.
Example 4: Real-World Scenario¶
sudo ss -ltnp sport = :80
Use this pattern when the task moves beyond a single basic command.
Example 5: Verification¶
ss -s
Example output:
Total: 512
TCP: 18 (estab 4, closed 6, orphaned 0, timewait 6)
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 -tan state established
sudo ss -ltnp sport = :80
ss -s
Related Guides¶
Summary¶
Good ss usage means choosing the right option, keeping the target clear, and verifying the result with output you can explain.