Bird
0
0

You want to create empty files named day1.txt through day5.txt quickly. Which command achieves this?

hard📝 Application Q8 of 15
Linux CLI - File and Directory Operations
You want to create empty files named day1.txt through day5.txt quickly. Which command achieves this?
Atouch day{1..5}.txt
Btouch day[1-5].txt
Ctouch day{1-5}.txt
Dtouch day*.txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand brace expansion in shell

    Brace expansion like {1..5} generates a sequence of strings, so day{1..5}.txt expands to day1.txt day2.txt ... day5.txt.
  2. Step 2: Evaluate options

    touch day{1..5}.txt uses brace expansion correctly. touch day[1-5].txt uses character class which matches single characters, not sequence. touch day{1-5}.txt uses invalid brace range syntax (missing ..). touch day*.txt uses wildcard which matches existing files, not create new ones.
  3. Final Answer:

    touch day{1..5}.txt -> Option A
  4. Quick Check:

    Brace expansion creates multiple files quickly = B [OK]
Quick Trick: Use brace expansion {1..5} to create numbered files fast [OK]
Common Mistakes:
  • Using character classes instead of brace expansion
  • Using wildcard which matches existing files
  • Using invalid brace range like {1-5}

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes