How to Copy the Contents of a Folder to Another Folder from Terminal in Ubuntu
belongs to collection: Ubuntu / Linux Frequently Asked Questions
All Answers
total answers (1)
belongs to collection: Ubuntu / Linux Frequently Asked Questions
total answers (1)
Use the
cp
CommandYou can use the
cp
command to copy files locally from one directory to another.For instance, if you want to copy the contents of the
source
folder to thedestination
folder in your current working directory, you can use the following command:The
-a
option copy files recursively, while preserving the file attributes such as timestamp. The period symbol (.
) at end of the source path allows to copy all files and folders, including hidden ones.For example, if your current working directory is
/var/www
and you want to copy the contents of theassets
folder tobackup
folder, you can simply use the command:Alternatively, you can provide absolute path like this:
Both commands will have the same effect, because current working directory doesn't matter when you use absolute path. Any path that starts with a forward slash
need an explanation for this answer? contact us directly to get an explanation for this answer/
is an absolute path.