Introduction
In this challenge, you find yourself in the vast expanse of the Arabian Desert, where you encounter Saladin, the legendary Sultan of Egypt and Syria. Saladin presents you with a task: to demonstrate your proficiency in using the cp command in the Linux environment. The goal is to impress Saladin with your file copying skills to secure a safe passage through the desert.
Basic File Copying
There is a file named source.txt in the /home/labex/project directory. Your task is to copy the contents of source.txt to a new file named destination.txt.
Tasks
- Copy a file named
source.txtto a new file nameddestination.txt.
Requirements
- Navigate to the directory containing the file
source.txtusing the terminal. - Use the
cpcommand to createdestination.txtwith the contents ofsource.txt.
Example
Once completed, the contents of source.txt should be successfully duplicated into destination.txt.
Recursive Directory Copy
Saladin is impressed with your file copying skills and presents you with a more challenging task. You must now copy the entire content of the current directory, including all files and subdirectories, to a new directory named backup.
Tasks
- Create a directory named
backupin the/home/labex/projectdirectory. - Copy all the
/tmpdirectory's content, including files and subdirectories, to the newly createdbackupdirectory.
Requirements
- The terminal's default working directory should be the location of the content to be copied.
- Use the
cpcommand with appropriate flags to copy the directory content recursively. - Use
sudoif necessary to copy files that require elevated permissions.
Example
After completion, the backup directory should contain a replica of the original directory's content and structure.
Summary
In this challenge, we ventured into the arid landscape of the Arabian Desert and encountered Saladin, who tasked us with demonstrating our skills in Linux file copying using the cp command. The challenge covered fundamental file copying and recursive directory copying, allowing for a practical understanding of these essential Linux skills. This journey not only honed our abilities but also provided a valuable opportunity to impress the legendary Saladin.



