Bird
0
0

Given the commands:

medium📝 Command Output Q13 of 15
Linux CLI - File and Directory Operations
Given the commands:
mkdir testdir
touch file1.txt
mv file1.txt testdir/
What will be the result?
AError: testdir does not exist
Bfile1.txt is moved inside testdir folder
CA new file named testdir is created
Dfile1.txt is renamed to testdir
Step-by-Step Solution
Solution:
  1. Step 1: Create directory and file

    mkdir testdir creates a folder named testdir. touch file1.txt creates an empty file named file1.txt.
  2. Step 2: Move file into directory

    mv file1.txt testdir/ moves file1.txt into the folder testdir, keeping the same name.
  3. Final Answer:

    file1.txt is moved inside testdir folder -> Option B
  4. Quick Check:

    mv file to folder = move inside folder [OK]
Quick Trick: mv file folder/ moves file inside folder [OK]
Common Mistakes:
MISTAKES
  • Thinking mv renames file to folder name
  • Assuming mv creates new files
  • Believing error occurs if folder exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes