2015-10-08 11:15:08 -04:00
|
|
|
.Dd 2015-10-08
|
2015-01-31 08:20:02 -05:00
|
|
|
.Dt CP 1
|
2015-01-31 14:37:03 -05:00
|
|
|
.Os sbase
|
2015-01-30 16:07:17 -05:00
|
|
|
.Sh NAME
|
|
|
|
.Nm cp
|
|
|
|
.Nd copy files and directories
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2015-02-17 11:13:45 -05:00
|
|
|
.Op Fl afpv
|
|
|
|
.Oo
|
|
|
|
.Fl R
|
|
|
|
.Op Fl H | L | P
|
|
|
|
.Oc
|
2017-01-29 16:17:09 -05:00
|
|
|
.Ar source ...
|
|
|
|
.Ar dest
|
2015-01-30 16:07:17 -05:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
2015-03-02 13:15:19 -05:00
|
|
|
copies
|
|
|
|
.Ar source
|
|
|
|
to
|
|
|
|
.Ar dest .
|
|
|
|
If more than one
|
|
|
|
.Ar source
|
|
|
|
is given
|
|
|
|
.Ar dest
|
|
|
|
has to be a directory.
|
2015-01-30 16:07:17 -05:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl a
|
2015-03-02 13:15:19 -05:00
|
|
|
Preserve block devices, character devices, sockets and FIFOs. Implies
|
|
|
|
.Fl p ,
|
|
|
|
.Fl P
|
2015-01-30 16:07:17 -05:00
|
|
|
and
|
2015-03-02 13:15:19 -05:00
|
|
|
.Fl R .
|
2015-02-01 14:52:28 -05:00
|
|
|
.It Fl f
|
2015-03-02 13:15:19 -05:00
|
|
|
If an existing
|
|
|
|
.Ar dest
|
|
|
|
cannot be opened, remove it and try again.
|
2015-02-17 11:13:45 -05:00
|
|
|
.It Fl p
|
|
|
|
Preserve mode, timestamp and permissions.
|
|
|
|
.It Fl v
|
2015-03-02 13:15:19 -05:00
|
|
|
Write "'source' -> 'dest'" for each
|
|
|
|
.Ar source
|
|
|
|
to stdout.
|
2015-02-09 16:11:06 -05:00
|
|
|
.It Fl H
|
2015-03-02 13:15:19 -05:00
|
|
|
Dereference
|
|
|
|
.Ar source
|
|
|
|
if it is a symbolic link.
|
2015-02-09 16:11:06 -05:00
|
|
|
.It Fl L
|
2015-03-02 13:15:19 -05:00
|
|
|
Dereference all symbolic links.
|
cp: Default to -P when -R is specified
POSIX only specifies the -H, -L, and -P options for use with -R, and
the default is left to the implementation. Without -R, symlinks must
be followed.
Most implementations use -P as the default with -R, which makes sense
to me as default behavior (the source and destination trees are the same).
Since we use the same code for -R and without it, and we allow -H, -L,
and -P without -R, set the default based on the presence of -R. Without
it, use -L as before, as required by POSIX, and with it, use -P to match
the behavior of other implementations.
2019-12-22 00:08:36 -05:00
|
|
|
This is the default without
|
|
|
|
.Fl R .
|
2015-01-30 16:07:17 -05:00
|
|
|
.It Fl P
|
2015-03-02 13:15:19 -05:00
|
|
|
Preserve symbolic links.
|
cp: Default to -P when -R is specified
POSIX only specifies the -H, -L, and -P options for use with -R, and
the default is left to the implementation. Without -R, symlinks must
be followed.
Most implementations use -P as the default with -R, which makes sense
to me as default behavior (the source and destination trees are the same).
Since we use the same code for -R and without it, and we allow -H, -L,
and -P without -R, set the default based on the presence of -R. Without
it, use -L as before, as required by POSIX, and with it, use -P to match
the behavior of other implementations.
2019-12-22 00:08:36 -05:00
|
|
|
This is the default with
|
|
|
|
.Fl R .
|
2015-03-02 13:15:19 -05:00
|
|
|
.It Fl R
|
|
|
|
Traverse directories recursively. If this flag is not specified, directories
|
|
|
|
are not copied.
|
2015-01-30 16:07:17 -05:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr mv 1
|
2015-03-02 13:15:19 -05:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is compliant with the
|
2015-03-27 12:22:48 -04:00
|
|
|
.St -p1003.1-2013
|
2015-03-02 13:15:19 -05:00
|
|
|
specification except from the
|
|
|
|
.Op Fl i
|
|
|
|
flag.
|
|
|
|
.Pp
|
2015-03-27 12:22:48 -04:00
|
|
|
The
|
2015-03-02 13:15:19 -05:00
|
|
|
.Op Fl av
|
2015-03-27 12:22:48 -04:00
|
|
|
flags are an extension to that specification.
|