The -r option (or --recursive) in the cp command is used to copy directories and their contents recursively. This means that when you use this option, the command will copy not only the specified directory but also all of its subdirectories and files.
Purpose:
- Copy Entire Directory Structures: The
-roption allows you to duplicate an entire directory along with all its nested files and subdirectories in one command.
Example Usage:
cp -r source_directory destination_directory
In this example, source_directory and all of its contents (files and subdirectories) will be copied to destination_directory.
Important Note:
- Without the
-roption, thecpcommand will not copy directories and will return an error if you try to do so.
If you have any further questions or need more details, feel free to ask!
