cp(1)cp(1)Namecp - copy file data
Syntaxcp [ -f ] [ -i ] [ -p ] file1 file2
cp [ -f ] [ -i ] [ -p ] [ -r ] file... directory
cp [ -f ] [ -i ] [ -p ] [ -r ] directory... directory
The command copies file1 onto file2. The mode and owner of file2 are
preserved if it already existed; the mode of file1 is used otherwise.
Note that the command will not copy a file onto itself.
In the second form, one or more files are copied into the directory
with their original file names.
In the third form, one or more source directories are copied into the
destination directory with their original file names.
Options-f Forces existing destination pathnames to be removed before copy‐
ing, without prompting for confirmation. The -i option is ignored
if the -f option is specified.
-i Prompts user with the name of file whenever the copy will cause an
old file to be overwritten. A yes answer will cause to continue.
Any other answer will prevent it from overwriting the file.
-p Preserves (duplicates) in the copies the modification time, access
time, file mode, user ID, and group ID as allowed by the permis‐
sions of the source files, ignoring the present umask.
-r Copies directories. Entire directory trees, including their sub‐
trees and the individual files they contain, are copied to the
specified destination directory. The directory, its subtrees, and
the individual files retain their original names. For example, to
copy the directory including all of its subtrees and files, into
the directory enter the following command:
cp-r reports news
See Alsocat(1), pr(1), mv(1)cp(1)