Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to move the file named file1.txt to the directory backup/.
Linux CLI
mv file1.txt [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same filename as destination does not move the file.
Specifying a filename instead of a directory when intending to move into a folder.
✗ Incorrect
The
mv command moves the file file1.txt into the directory backup/.2fill in blank
mediumComplete the code to rename the file report.txt to summary.txt in the current directory.
Linux CLI
mv [1] summary.txt Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the source and destination names.
Omitting the file extension.
✗ Incorrect
To rename a file, use
mv with the current filename as the first argument and the new filename as the second.3fill in blank
hardFix the error in the command to move data.csv into the directory /archive.
Linux CLI
mv data.csv [1]archive Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing slash causes the command to look for a file named 'data.csvarchive'.
Using tilde
~ incorrectly when not referring to home directory.✗ Incorrect
To specify an absolute directory path, use a leading slash
/. Here, /archive is the archive directory in the root, and the slash properly separates the source filename from the destination path.4fill in blank
hardFill both blanks to move notes.txt to the directory docs and rename it to meeting.txt.
Linux CLI
mv notes.txt [1]/[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the old filename instead of the new one.
Using a wrong directory name.
✗ Incorrect
The command moves
notes.txt into the docs directory and renames it to meeting.txt by specifying the new path and filename.5fill in blank
hardFill all three blanks to rename all files with extension .txt in the current directory by moving them to texts folder and changing their extension to .bak using a loop.
Linux CLI
for file in *.txt; do mv [1] [2]/$[3].bak; done
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names.
Not removing the .txt extension before adding .bak.
Using incorrect directory name.
✗ Incorrect
The loop moves each
.txt file to the texts directory and renames it by removing the .txt extension and adding .bak instead.