Copying
-
5. Copying Files & Directories
Experiment How to Copy Directories and Files.
-
To Copy a Single File:
* As in the other cases here ‘cp‘ is the Abbreviation for ‘Copy‘ *cp $HOME/livingroom/box $HOME/bedroom/
You see how in this Example we copied our ‘box’ from the ‘livingroom’ to the ‘bedroom.’ :)
Now verify the correctness of the operation Listing your’s bedroom contents:
ls $HOME/bedroom/
And the Output will exactly display as:
box
-
Now for Instance to Copy a Single Directory inside to another do:
cp -r $HOME/livingroom $HOME/garden
List the ‘garden’ contents:
ls $HOME/garden
And you’ll Find:
livingroom
Now you have also a ‘livingroom’ copy into your ‘garden’ O:
Moreover, to Copy-Duplicate-Rename a Directory:
First, to be sure you are again into the $HOME area:
cd
And then Make a newly duplicated room do:
cp -r ./livingroom ./room
Finally, to Copy-Displace-Rename at the same time:
cp -r $HOME/livingroom $HOME/bedroom/wardrobe
By the way with this “magically crazy” Command we have trasformed our ‘livingroom’ into a ‘wardrobe’ inside to the ‘bedroom’ :))
-
Contents