How To Copy Entire Directory In Linux?

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM

Linux provides different tools to copy directories entirely. The most popular and well known tool is cp . In this tutorial we will look how to copy Linux directories entirely or specific contents.

Copy Only Directory

In this first example we will copy only directory. We can just provide the source directory and destination directory names to the cp command. In this example we will try to copy single directory. As we can see we get an error like below.

Copy Only Directory

Copy Only Directory

Copy Entire Directory Recursively

Now here is the real scenario. We will copy our directory named backup with new named newbackup . We will use -r option which makes copy operation recursively. Recursive means sub directories and files will be copied too.

Copy Entire Directory Recursively

Copy Entire Directory Recursively

Copy Special Files

During recursive copy operation special files content will not copied by default. We can copy special file contents with -b option like below.

Copy Verbosely

During copy operation there will be no sign about current operation. We can made this copy operation verbose where copied files will be printed to the shell. We will use -v command like below.

Copy Verbosely

Copy Verbosely

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM
LEARN MORE  Useful Linux Commands A System Administrator Should Know

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)