Bird
0
0

Which of the following is the correct syntax to count only the number of lines in a file named file.txt?

easy📝 Syntax Q12 of 15
Linux CLI - Viewing and Editing Files
Which of the following is the correct syntax to count only the number of lines in a file named file.txt?
Awc -w file.txt
Bwc -l file.txt
Cwc -c file.txt
Dwc -m file.txt
Step-by-Step Solution
Solution:
  1. Step 1: Identify option for line count

    The -l option with wc counts lines in the file.
  2. Step 2: Verify other options

    -w counts words, -c counts bytes, and -m counts characters, so they are incorrect for line count.
  3. Final Answer:

    wc -l file.txt -> Option B
  4. Quick Check:

    -l means lines [OK]
Quick Trick: Use -l to count lines, not -w or -c [OK]
Common Mistakes:
MISTAKES
  • Using -w or -c instead of -l
  • Forgetting the filename
  • Mixing up -m and -c options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes