0
0
Linux CLIscripting~20 mins

netstat and ss (connection listing) in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Network Socket Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this ss command?
You run the command ss -tuln on a Linux system. What does this command show?
Linux CLI
ss -tuln
ALists all TCP and UDP sockets that are listening, showing numeric addresses and ports.
BLists all established TCP connections only, resolving hostnames.
CShows all UDP sockets including those in TIME_WAIT state.
DDisplays all network interfaces and their IP addresses.
Attempts:
2 left
💡 Hint
Look at the flags: -t (TCP), -u (UDP), -l (listening), -n (numeric).
💻 Command Output
intermediate
1:30remaining
What is the output of this netstat command?
You run netstat -an | grep ESTABLISHED. What does this command output?
Linux CLI
netstat -an | grep ESTABLISHED
ALists all active TCP connections that are currently established, showing numeric addresses.
BLists all UDP sockets that are listening.
CShows routing table entries with established routes.
DDisplays all network interfaces and their MAC addresses.
Attempts:
2 left
💡 Hint
The -a flag shows all sockets, -n numeric addresses, and grep ESTABLISHED filters connections in established state.
📝 Syntax
advanced
1:30remaining
Which ss command syntax correctly shows all UDP sockets including listening and non-listening?
Choose the correct ss command to list all UDP sockets, both listening and non-listening.
Ass -t -a
Bss -l -u
Css -u -a
Dss -a -t
Attempts:
2 left
💡 Hint
The -u flag is for UDP, -a shows all sockets.
🔧 Debug
advanced
2:00remaining
Why does this netstat command fail with an error?
You run netstat -ltupn and get an error: "netstat: option requires an argument -- 'p'". What is wrong?
Linux CLI
netstat -ltupn
AThe <code>-p</code> option is deprecated and not supported in this netstat version.
BThe <code>-p</code> option is missing a value; it requires a protocol name after it.
CThe options are in wrong order; <code>-p</code> must come before <code>-n</code>.
DThe <code>-p</code> option requires root privileges to show process info; running as normal user causes error.
Attempts:
2 left
💡 Hint
Check if you have permission to use -p option.
🚀 Application
expert
1:30remaining
How many TCP connections are in the LISTEN state after running this command?
You run ss -tn state LISTEN on a server. The output shows these lines:
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*
LISTEN 0      100          [::]:80           [::]:*

How many TCP connections are in the LISTEN state?
Linux CLI
ss -tn state LISTEN
A0
B2
C1
D128
Attempts:
2 left
💡 Hint
Count the number of LISTEN lines in the output.