Bird
0
0

You want to create empty files named log1.txt, log2.txt, ..., log5.txt quickly using a single command. Which command achieves this?

hard📝 Application Q15 of 15
Linux CLI - File and Directory Operations
You want to create empty files named log1.txt, log2.txt, ..., log5.txt quickly using a single command. Which command achieves this?
Atouch log*.txt
Btouch log{1..5}.txt
Ctouch log1.txt log2.txt log3.txt log4.txt log5.txt
Dtouch log[1-5].txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand brace expansion

    The syntax log{1..5}.txt uses brace expansion to create multiple filenames from 1 to 5.
  2. Step 2: Evaluate other options

    log[1-5].txt matches single characters in brackets, not ranges. Listing all files manually works but is long. log*.txt matches existing files, not create new ones.
  3. Final Answer:

    touch log{1..5}.txt -> Option B
  4. Quick Check:

    Brace expansion creates multiple files fast [OK]
Quick Trick: Use brace expansion: touch file{1..5}.ext [OK]
Common Mistakes:
  • Using square brackets instead of braces for ranges
  • Typing all filenames manually instead of using expansion
  • Using wildcard which matches existing files only

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes