Quick Answer: How Do I Copy Content from One Directory to Another in Linux?
Contents Options Description -R/R Copy Directories Recursively -N Don’t Overwrite an Existing File -D Copy a Link File -I Prompt Before Overwrite How Do You...
| Options | Description |
|---|---|
| -r/R | Copy directories recursively |
| -n | Don’t overwrite an existing file |
| -d | Copy a link file |
| -i | Prompt before overwrite |
How do you copy the contents of a directory to another in Linux?
In order to copy a directory on Linux, you have to execute the “cp” command with the “-R” option for recursive and specify the source and destination directories to be copied. As an example, let’s say that you want to copy the “/etc” directory into a backup folder named “/etc_backup”.
Must Read
How do I copy a file from one directory to another?
To copy a file to another directory, specify the absolute or the relative path to the destination directory. When only the directory name is specified as a destination, the copied file has the same name as the original file. If you want to copy the file under a different name, you need to specify the desired file name.