CompTIA Linux+ (XK0-006)TroubleshootingMedium
A technician needs to verify which services on a server are actively listening for incoming TCP and UDP connections, showing port numbers without resolving hostnames. Which command accomplishes this?
- Adig -x localhost
- Bss -tuln
- Css -a
- Dip addr show
Show answer & explanationAnswer & explanation
Correct answer: B. ss -tuln
ss -tuln combines -t (TCP), -u (UDP), -l (listening sockets only), and -n (numeric, skip name resolution), giving exactly the listening ports on the server without DNS lookups slowing the output.
Why the other options are wrong
- A. dig -x performs reverse DNS lookups, unrelated to local listening sockets.
- C. ss -a lists all sockets (listening and established) and would resolve names by default, which is not what's needed.
- D. ip addr show displays interface IP addresses, not socket/port information.
ss Socket Statistics
ss is a modern replacement for netstat used to display socket information; combining flags like -tuln filters to numeric, listening TCP/UDP sockets.
- -t = TCP sockets
- -u = UDP sockets
- -l = listening only
- -n = numeric (no DNS resolution)
Memory trick: T-U-L-N: 'Totally Useful Listing, Numeric' for finding open ports