Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to list all active TCP connections using netstat.
Linux CLI
netstat [1] tcp Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-r' which shows routing tables instead of connections.
Using '-s' which shows statistics, not connections.
✗ Incorrect
The '-a' option shows all active connections and listening ports.
2fill in blank
mediumComplete the command to display listening sockets only using ss.
Linux CLI
ss [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-a' which shows all sockets, not just listening ones.
Using '-t' which filters TCP sockets only.
✗ Incorrect
The '-l' option shows only listening sockets.
3fill in blank
hardFix the error in the command to show numeric addresses with netstat.
Linux CLI
netstat [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-a' which shows all connections but not numeric addresses.
Using '-p' which shows process info but not numeric addresses.
✗ Incorrect
The '-n' option forces numeric output of addresses and ports.
4fill in blank
hardFill both blanks to list all UDP connections with ss and show process info.
Linux CLI
ss [1] [2] udp
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-l' which shows only listening sockets, missing active connections.
Using '-u' which is redundant since 'udp' is already specified.
✗ Incorrect
Use '-a' to show all sockets and '-p' to show process info.
5fill in blank
hardFill all three blanks to create a dictionary comprehension that maps ports to states for TCP connections using ss.
Linux CLI
connections = [1]: [2] for [3] in ss_output if 'tcp' in [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'conn['proto']' as key or value instead of port or state.
Using wrong loop variable or missing it.
✗ Incorrect
We map port to state for each connection in ss_output where protocol is TCP.