0
0
Linux CLIscripting~15 mins

cp (copy files and directories) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Copy Files and Directories Using cp Command
📖 Scenario: You are organizing your documents and want to make copies of important files and folders to a backup directory.
🎯 Goal: Learn how to use the cp command to copy files and directories in Linux.
📋 What You'll Learn
Use the cp command to copy files
Use the cp -r option to copy directories recursively
Understand how to specify source and destination paths
Verify the copied files and directories
💡 Why This Matters
🌍 Real World
Copying files and folders is a common task when backing up data or organizing files on your computer.
💼 Career
Knowing how to use the <code>cp</code> command is essential for system administrators, developers, and anyone working with Linux or Unix systems.
Progress0 / 4 steps
1
Create a file to copy
Create a file named report.txt with the exact content Monthly sales report using the echo command and redirect it to the file.
Linux CLI
Need a hint?

Use echo "text" > filename to create a file with text.

2
Create a directory to copy
Create a directory named backup using the mkdir command.
Linux CLI
Need a hint?

Use mkdir directory_name to create a directory.

3
Copy the file to the directory
Use the cp command to copy the file report.txt into the backup directory.
Linux CLI
Need a hint?

Use cp source_file destination_directory/ to copy a file.

4
Verify the copied file
Use the ls command to list the contents of the backup directory and confirm that report.txt is copied.
Linux CLI
Need a hint?

Use ls directory_name to see files inside a directory.