0
0
Linux CLIscripting~10 mins

mv (move and rename) in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Afile1.txt
Bfile2.txt
C/home/user
Dbackup/
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.
2fill in blank
medium

Complete 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'
Areport.txt
Bsummary
Creport
Dsummary.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the source and destination names.
Omitting the file extension.
3fill in blank
hard

Fix 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'
A~
B/
C-
D.
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.
4fill in blank
hard

Fill 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'
Adocs
Bnotes.txt
Cmeeting.txt
Dbackup
Attempts:
3 left
💡 Hint
Common Mistakes
Using the old filename instead of the new one.
Using a wrong directory name.
5fill in blank
hard

Fill 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'
Afile
Btexts
Cfile%.txt
Dfiles
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names.
Not removing the .txt extension before adding .bak.
Using incorrect directory name.