CP(1)

NAME
cp - copy files

SYNOPSIS
cp [-f] [-i] [-p] [-r | -R] file1 [file2 . . . ] target

DESCRIPTION
File1 is copied onto target. If target is an existing regular file, its content is overwritten. Its mode and owner are preserved; the mode of the source file is used otherwise.

If target is a directory, one or more files are copied into the directory with their original file-names.

Cp refuses to copy a file onto itself.

The cp command accepts the following options:

-f  If overwriting a target file fails, cp will try to unlink that file and proceed. Overrides the -i option in /usr/local/heirloom/usr/local/heirloom/usr/5bin/s42/cp and /usr/local/heirloom/usr/local/heirloom/usr/5bin/posix/cp.

-i  Cp will ask for confirmation before overwriting an existing target. For /usr/local/heirloom/usr/5bin/cp, this flag will be automatically disabled if standard input is not a terminal. Overrides the -f option in /usr/local/heirloom/usr/local/heirloom/usr/5bin/s42/cp and /usr/local/heirloom/usr/local/heirloom/usr/5bin/posix/cp.

-p  Cp will try to preserve access and modification times, user and group ownerships and file permission bits. Failing to preserve these modes is always considered an error, but only /usr/local/heirloom/usr/local/heirloom/usr/5bin/s42/cp and /usr/local/heirloom/usr/local/heirloom/usr/5bin/posix/cp will print an error message.

-R  The source file operands may be directories that will be copied recursively. Special files such as block and character devices, FIFOs, and symbolic links encountered during traversal are recreated in the target hierarchy. If a symbolic link is given as an operand, its target is copied.

-r  The source file operands may be directories that will be copied recursively. Symbolic links are followed. The content of all non-directory files encountered is tried to be reproduced in a regular file.

SEE ALSO
cat(1), cpio(1), mv(1), pr(1), rm(1)

NOTES
Use either

    cp -- -file target

or

    cp ./-file target

to copy files that begin with a hyphen character.

Files copied with cp will lose all hard link connection. Use cpio(1) to copy while retaining hard links.

A copy of a symbolic link contains the same pathname as the original. Symbolic links with relative pathnames may thus change or lose their target if copied to a different level in the file hierarchy.