You want to create empty files for each month abbreviation (Jan, Feb, Mar) with .log extension. Which command is best?
hard📝 Application Q9 of 15
Linux CLI - File and Directory Operations
You want to create empty files for each month abbreviation (Jan, Feb, Mar) with .log extension. Which command is best?
Atouch {Jan,Feb,Mar}.log
Btouch Jan Feb Mar.log
Ctouch Jan.log,Feb.log,Mar.log
Dtouch Jan-Feb-Mar.log
Step-by-Step Solution
Solution:
Step 1: Use brace expansion for multiple specific names
Brace expansion with comma-separated values creates multiple files with given names and extensions.
Step 2: Compare options
touch {Jan,Feb,Mar}.log correctly creates Jan.log, Feb.log, Mar.log. touch Jan.log,Feb.log,Mar.log uses commas which is invalid. touch Jan Feb Mar.log creates files Jan, Feb, and a file named Mar.log. touch Jan-Feb-Mar.log creates one file named Jan-Feb-Mar.log.
Final Answer:
touch {Jan,Feb,Mar}.log -> Option A
Quick Check:
Brace expansion with commas creates multiple named files = C [OK]
Quick Trick:Use {a,b,c} to create multiple specific files quickly [OK]
Common Mistakes:
MISTAKES
Listing files without extensions
Creating one combined filename
Using commas instead of spaces
Master "File and Directory Operations" in Linux CLI
9 interactive learning modes - each teaches the same concept differently