Bird
0
0

What will be the output of the command netstat -tuln | grep ':22' if the SSH service is running and listening on port 22?

medium📝 Command Output Q13 of 15
Linux CLI - Networking Commands
What will be the output of the command netstat -tuln | grep ':22' if the SSH service is running and listening on port 22?
ANo output, because port 22 is not shown
BAn error message about invalid syntax
CA line showing TCP port 22 in LISTEN state
DA list of all UDP ports except 22
Step-by-Step Solution
Solution:
  1. Step 1: Understand command components

    netstat -tuln lists TCP and UDP ports numerically and listening; grep ':22' filters lines with ':22'.
  2. Step 2: Interpret output if SSH runs

    If SSH listens on port 22, output will include a line showing TCP port 22 in LISTEN state.
  3. Final Answer:

    A line showing TCP port 22 in LISTEN state -> Option C
  4. Quick Check:

    SSH on port 22 = netstat output with :22 line [OK]
Quick Trick: grep ':22' filters netstat output for SSH port [OK]
Common Mistakes:
  • Expecting no output if port is open
  • Thinking command syntax is invalid
  • Confusing UDP ports with TCP port 22

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes