cp -- copy files and directories



cp is as specified in the Single UNIX Specification but with differences as listed below.

LSB Deprecated Differences

The behaviors specified in this section are expected to disappear from a future version of the LSB; applications should only use the non-LSB-deprecated behaviors.

-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.