Bird
0
0

What will be the output of the following commands?

medium📝 Command Output Q13 of 15
Linux CLI - File and Directory Operations
What will be the output of the following commands?
touch file1.txt file2.txt
ls -l file1.txt file2.txt
ACreates only file1.txt and ignores file2.txt
BShows an error because multiple files cannot be created with touch
CDeletes file1.txt and file2.txt
DLists details of file1.txt and file2.txt, both created as empty files
Step-by-Step Solution
Solution:
  1. Step 1: Understand touch with multiple files

    The touch command can create multiple files at once by listing them separated by spaces.
  2. Step 2: Check ls -l output

    The ls -l command lists detailed info of the files, showing their size (0 bytes if empty) and timestamps.
  3. Final Answer:

    Lists details of file1.txt and file2.txt, both created as empty files -> Option D
  4. Quick Check:

    touch multiple files = creates all listed [OK]
Quick Trick: touch can create many files at once by listing them [OK]
Common Mistakes:
  • Thinking touch only creates one file at a time
  • Expecting an error with multiple filenames
  • Confusing touch with delete or move commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes