Copying Files Using cp

To copy files, we could use the cp command. The general format of the command when used for simple copying is as follows:

matthew@seymour:~$ cp -a source_directory target_directory

The -a argument is the same as giving -dpR, which would be

Image -d—Preserves symbolic links (by not dereferencing them) and copies the files that they point to instead of copying the links.

Image -p—Preserves all file attributes if possible. (File ownership might interfere.)

-R—Copies directories recursively.

The cp command ...

Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.