cp(1) UNIX System V(Essential Utilities) cp(1)
NAME
cp - copy files
SYNOPSIS
cp [ -i ] [ -p ] [ -r ] file1 [ file2 ...] target
DESCRIPTION
The cp command copies filen to target. filen and target may not have the
same name. (Care must be taken when using sh(1) metacharacters.) If
target is not a directory, only one file may be specified before it; if
it is a directory, more than one file may be specified. If target does
not exist, cp creates a file named target. If target exists and is not a
directory, its contents are overwritten. If target is a directory, the
file(s) are copied to that directory.
The following options are recognized:
-i cp will prompt for confirmation whenever the copy would overwrite
an existing target. A y answer means that the copy should proceed.
Any other answer prevents cp from overwriting target.
-p cp will duplicate not only the contents of filen, but also
preserves the modification time and permission modes.
-r If filen is a directory, cp will copy the directory and all its
files, including any subdirectories and their files; target must be
a directory.
If filen is a directory, target must be a directory in the same physical
file system. target and filen do not have to share the same parent
directory.
If filen is a file and target is a link to another file with links, the
other links remain and target becomes a new file.
If target does not exist, cp creates a new file named target which has
the same mode as filen except that the sticky bit is not set unless the
user is a privileged user; the owner and group of target are those of the
user.
If target is a file, its contents are overwritten, but the mode, owner,
and group associated with it are not changed. The last modification time
of target and the last access time of filen are set to the time the copy
was made.
If target is a directory, then for each file named, a new file with the
same mode is created in the target directory; the owner and the group are
those of the user making the copy.
NOTES
A -- permits the user to mark the end of any command line options
explicitly, thus allowing cp to recognize filename arguments that begin
10/89 Page 1
cp(1) UNIX System V(Essential Utilities) cp(1)
with a -. If a -- and a - both appear on the same command line, the
second will be interpreted as a filename.
SEE ALSO
chmod(1), cpio(1), ln(1), mv(1), rm(1).
Page 2 10/89