CP(1) CP(1)
NAME
cp, fcp, mv - copy, move files
SYNOPSIS
cp [ -gux ] file1 file2
cp [ -gux ] file ... directory
fcp [ -gux ] file1 file2
fcp [ -gux ] file ... directory
mv file1 file2
mv file ... directory
DESCRIPTION
In the first form file1 is any name and file2 is any name
except an existing directory. In the second form the com-
mands copy or move one or more files into a directory under
their original file names, as if by a sequence of commands
in the first form. Thus `cp f1 f2 dir' is equivalent to `cp
f1 dir/f1; cp f2 dir/f2'.
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. The -x option sets the
mode and modified time of file2 from file1; -g sets the
group id; and -u sets the group id and user id (which is
usually only possible if the file server is in an adminis-
trative mode).
Fcp behaves like cp but transfers multiple blocks in paral-
lel while copying; it is noticeably faster than cp when the
files involved are stored on servers connected over long-
distance lines. It is only appropriate to use fcp with file
servers that respect the offset in read(5) and write mes-
sages. This includes the disk-based file systems and ramfs
but excludes most device file systems.
Mv moves file1 to file2. If the files are in the same
directory, file1 is just renamed; otherwise mv behaves like
cp -x followed by rm file1. Mv will rename directories, but
it refuses to move a directory into another directory.
SOURCE
/sys/src/cmd/cp.c
/sys/src/cmd/fcp.c
/sys/src/cmd/mv.c
SEE ALSO
cat(1), dircp in tar(1), stat(2), read(5)
Page 1 Plan 9 (printed 10/25/26)
CP(1) CP(1)
DIAGNOSTICS
Cp, fcp, and mv refuse to copy or move files onto them-
selves.
Page 2 Plan 9 (printed 10/25/26)