Linux - How to copy the entire directory

By xngo on June 8, 2019

The copy command to copy the entire directory is: cp -r source_dir destination_dir

Note: -r stands for copy directories recursively.

Here are some examples:

# Copy everything from current directory to /tmp directory
cp -r * /tmp
 
# Copy the whole /tmp directory to /root directory
cp -r /tmp /root

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.