How to copy a directory on the Linux / Unix based operating systems from the command line using the cp command (the linux copy command). To copy a directory in Linux we need to use the recursive option for the cp comamnd.
Linux Copy Directory Command
Linux copy directory command:
1
|
|
Note, the above cp command uses the -r option which stands for recursive.
In this exmaple you want to move the directory named “dir1” from /tmp to /root”:
1
|
|
Rename the directory you are copying
If you want to rename the directory you’re copying during the copy process use:
1
|
|
Drop me a comment below if this Linux copy directory HowTo helped you out :)