Power of ‘cp’

cp command we regularly use and it seems the simple to us. Let’s know the power of this command:

What we already know about ‘cp’ is- copy files and directories.

Ways to use: cp [OPTION]..SOURC DEST

It means copy source to destination or multiple sources to the destination. So, this is the basic idea of cp. Noe, let’s explore more about this. cp command comes with so many additional options like -a, -b, -f, -d, -i and so on.

Question1: What’s then if you want to copy all folders/directories recursively? You can’t do this with simple cp command.

Solution: Use the option -r, -R or -recursive to copy all directories recursively.

Question: When you need to create a backup of each existing destination file?

Solution: Use –backup[=CONTROL]

Practice these 15 examples in the post (link shared below) by linoxide:

http://linoxide.com/linux-command/linux-cp-command/

There are so many other examples. You can visit the following link for more detail:

http://manpages.ubuntu.com/manpages/wily/man1/cp.1.html

Advertisements

Published by

kaurdavinder

I am the one who discover myself daily through reading, writing, interacting with people and expressing my thoughts to inspire them if I would be able to bring a little change to the society through my work. I write blogs, participate in various social activities and want to be a Professional Speaker. Currently, I am pursuing my post graduation in Computer Applications from Guru Nanak Dev Engineering College, Ludhiana and I’m very much active in many technical & social communities.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s