cp -- copy files and directories



cp is as specified in the SUS but with differences as listed below.


-a archive

is the same as -dpR.


makes a backup of each existing destination file.


is like --backup but does not accept an argument.

-d, --no-dereference

never follows symbolic links.


follows command-line symbolic links.

-l, --link

links files instead of copying.

-L, --dereference

always follows symbolic links.


appends source path to DIRECTORY.


removes each existing destination file before attempting to open it. (Contrast with --force.)


controls creation of sparse files.

By default, sparse SOURCE files are detected by a crude heuristic and the corresponding DEST file is made sparse as well. That is the behavior selected by --sparse=auto. Specify --sparse=always to create a sparse DEST file whenever the SOURCE file contains a long enough sequence of zero bytes. Use --sparse=never to inhibit creation of sparse files.


removes any trailing slashes from each SOURCE argument.

-s, --symbolic-link

makes symbolic links instead of copying.

-S, --suffix=SUFFIX

overrides the usual backup suffix.


moves all SOURCE arguments into DIRECTORY.

-u, --update

copies only when the SOURCE file is newer than the destination file or when the destination file is missing.

-v, --verbose

explains what is being done.

-x, --one-file-system

stays on this file system.


outputs version information and exits.