0
0
Linux CLIscripting~10 mins

cp (copy files and directories) 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 command to copy a file named file1.txt to file2.txt.

Linux CLI
cp file1.txt [1]
Drag options to blanks, or click blank then click option'
Afile2.txt
B-r
Cfile1
Dcopy.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like -r when copying a single file.
Typing the wrong destination filename.
2fill in blank
medium

Complete the command to copy the directory docs and all its contents to backup_docs.

Linux CLI
cp [1] docs backup_docs
Drag options to blanks, or click blank then click option'
A-r
B-f
C-v
D-i
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the -r option when copying directories.
Using options that do not copy directories recursively.
3fill in blank
hard

Fix the error in the command to copy file.txt to backup/ directory, preserving attributes.

Linux CLI
cp [1] file.txt backup/
Drag options to blanks, or click blank then click option'
A-v
B-r
C-f
D-a
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r alone does not preserve attributes.
Forgetting to specify any option when copying directories.
4fill in blank
hard

Fill both blanks to copy all .txt files from source/ to dest/ with verbose output and prompt before overwrite.

Linux CLI
cp [1] [2] source/*.txt dest/
Drag options to blanks, or click blank then click option'
A-v
B-i
C-r
D-f
Attempts:
3 left
💡 Hint
Common Mistakes
Using -f which forces overwrite without prompt.
Using -r unnecessarily for files.
5fill in blank
hard

Fill all three blanks to copy directory project/ to backup/ preserving all attributes, showing progress, and forcing overwrite.

Linux CLI
cp [1] [2] [3] project/ backup/
Drag options to blanks, or click blank then click option'
A-a
B-v
C-f
D-i
Attempts:
3 left
💡 Hint
Common Mistakes
Using -i instead of -f when forcing overwrite.
Forgetting -a to preserve attributes.