Bird
0
0

Which of the following is the correct syntax to use the pipe operator to list files and then count them?

easy📝 Syntax Q12 of 15
Linux CLI - Pipes and Redirection
Which of the following is the correct syntax to use the pipe operator to list files and then count them?
Als & wc -l
Bls > wc -l
Cls || wc -l
Dls | wc -l
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct pipe syntax

    The pipe operator is |, which connects commands by passing output to input.
  2. Step 2: Check command usage

    ls | wc -l lists files and counts lines, which is correct syntax.
  3. Final Answer:

    ls | wc -l -> Option D
  4. Quick Check:

    Pipe syntax uses | between commands [OK]
Quick Trick: Use single | to pipe commands, not > or & [OK]
Common Mistakes:
  • Using > which redirects output to file
  • Using & which runs commands in background
  • Using || which is logical OR, not pipe

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes