Manual Page Result
0
Command: cp | Section: 1 | Source: UNIX v10 | File: cp.1
CP(1) General Commands Manual CP(1)
NAME
cp, mv, ln, reccp - copy, move, or link files
SYNOPSIS
cp [ -z ] file1 file2
cp [ -z ] file ... directory
mv [ -f ] file1 file2
mv [ -f ] file ... directory
ln [ -s ] file1 file2
ln [ -s ] file ... directory
reccp [ -z ] file1 file2
reccp [ -z ] file ... directory
DESCRIPTION
In the first form of each command, file2 is any name except an existing
directory. In the second form the command copies, moves, or links one
or more files into a directory under their original filenames, as if by
a sequence of commands in the first form. Thus is equivalent to
Cp copies the contents of plain file1 to file2. The mode and owner of
file2 are preserved if it already exists; the mode of file1 is used
otherwise.
Mv moves file1 to file2. If the two files are in the same file system,
the name file1 is simply changed to file2; if they are in different
file systems, file1 is copied and then removed. If file2 already ex-
ists, it is removed before file1 is moved. In this case the mode of
file2 is reported if it is not writable and the standard input is a
terminal. Respond (and newline) to permit removal.
Ln links plain file1 and file2. File2 becomes an alternate name for,
and is otherwise identical to, file1. File2 must be in the same file
system as file1 and must not already exist.
Reccp copies plain files like cp, but copies directories and their con-
tents recursively. It attempts to duplicate linkage and dates. When
run by the super-user, it preserves ownership and copies device files
as device files.
The options are:
-z Preserve `holes'; see lseek(2).
-f Forcibly remove file2 without asking.
-s Make symbolic links: record the (arbitrary) name file1 in file2.
Except in special cases, such as rm(1) and lstat (see stat(2)),
subsequent references to file2 are treated as references to
file1. See link(2) for details.
EXAMPLES
mkdir /usr1/ken; cp /usr/ken/* /usr1/ken
Place in /usr1/ken copies of all files from /usr/ken.
reccp /usr/ken /usr1
mkdir /usr1/ken; reccp /usr/ken/* /usr1/ken
Two ways to duplicate in /usr1/ken the whole file hierarchy from
/usr/ken.
SEE ALSO
cat(1), link(2), stat(2), push(1), uucp(1), rcp(1), cpio(1)
DIAGNOSTICS
Cp, mv, and reccp refuse to copy or move files onto themselves or di-
rectories into themselves.
BUGS
Mv to a different file system is imperfect: if file1 is a plain file
links to it are broken; if it is a directory, nothing happens.
CP(1)