Challenge - 5 Problems
mv Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this mv command?
You have a file named
What happens after this command?
report.txt in your current directory. You run the command:mv report.txt archive/What happens after this command?
Attempts:
2 left
💡 Hint
Think about how mv works when the destination is a directory.
✗ Incorrect
When the destination is an existing directory, mv moves the source file into that directory, keeping the same filename.
💻 Command Output
intermediate2:00remaining
What is the result of renaming a file with mv?
You have a file named
What is the state of the files after this command?
data.csv. You run:mv data.csv data_backup.csvWhat is the state of the files after this command?
Attempts:
2 left
💡 Hint
mv can rename files by changing the filename in the same directory.
✗ Incorrect
mv changes the filename by moving the file to a new name in the same location, effectively renaming it.
💻 Command Output
advanced2:00remaining
What error does this mv command produce?
You run the command:
as a normal user (not root). What happens?
mv file1.txt /root/as a normal user (not root). What happens?
Attempts:
2 left
💡 Hint
Consider user permissions for system directories.
✗ Incorrect
Normal users usually do not have write permission to /root, so mv fails with a permission denied error.
💻 Command Output
advanced2:00remaining
What is the output of this mv command with a wildcard?
You have files:
What happens?
img1.png, img2.png, and img3.png in your current directory. You run:mv img*.png images/What happens?
Attempts:
2 left
💡 Hint
mv supports wildcards expanded by the shell.
✗ Incorrect
The shell expands the wildcard to all matching files, so mv moves all those files into the target directory.
🚀 Application
expert3:00remaining
How to move and rename multiple files with a script?
You want to move all
Which bash script snippet correctly does this?
.log files from logs/ directory to archive/ directory and rename them by adding the prefix old_ to each filename.Which bash script snippet correctly does this?
Attempts:
2 left
💡 Hint
You need to loop over files and rename each individually.
✗ Incorrect
Option C loops over each .log file, moves it to archive with the prefix 'old_' added to the filename. Others either misuse mv or rename incorrectly.