Bird
0
0

What is the output of mkdir testdir && ls if testdir does not exist?

medium📝 Command Output Q4 of 15
Linux CLI - File and Directory Operations
What is the output of mkdir testdir && ls if testdir does not exist?
ACreates 'testdir' directory and lists it among files
BShows an error because 'testdir' exists
CDeletes 'testdir' directory
DLists files but does not create 'testdir'
Step-by-Step Solution
Solution:
  1. Step 1: Understand mkdir command

    mkdir creates a new directory named 'testdir' if it doesn't exist.
  2. Step 2: Understand ls command after mkdir

    ls lists current directory contents, now including 'testdir'.
  3. Final Answer:

    Creates 'testdir' directory and lists it among files -> Option A
  4. Quick Check:

    mkdir then ls output = A [OK]
Quick Trick: mkdir creates directory; ls shows it [OK]
Common Mistakes:
  • Thinking mkdir deletes directories
  • Assuming error if directory missing
  • Believing ls won't show new directory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes