2015-10-08 15:15:08 +00:00
|
|
|
.Dd 2015-10-08
|
2015-01-31 13:20:02 +00:00
|
|
|
.Dt CP 1
|
2015-01-31 19:37:03 +00:00
|
|
|
.Os sbase
|
2015-01-30 21:07:17 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm cp
|
|
|
|
.Nd copy files and directories
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2015-02-17 16:13:45 +00:00
|
|
|
.Op Fl afpv
|
|
|
|
.Oo
|
|
|
|
.Fl R
|
|
|
|
.Op Fl H | L | P
|
|
|
|
.Oc
|
2017-01-29 21:17:09 +00:00
|
|
|
.Ar source ...
|
|
|
|
.Ar dest
|
2015-01-30 21:07:17 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
2015-03-02 18:15:19 +00: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 21:07:17 +00:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl a
|
2020-03-01 22:37:31 +00:00
|
|
|
Preserve block devices, character devices, sockets and FIFOs.
|
|
|
|
Implies
|
2015-03-02 18:15:19 +00:00
|
|
|
.Fl p ,
|
|
|
|
.Fl P
|
2015-01-30 21:07:17 +00:00
|
|
|
and
|
2015-03-02 18:15:19 +00:00
|
|
|
.Fl R .
|
2015-02-01 19:52:28 +00:00
|
|
|
.It Fl f
|
2015-03-02 18:15:19 +00:00
|
|
|
If an existing
|
|
|
|
.Ar dest
|
|
|
|
cannot be opened, remove it and try again.
|
2015-02-17 16:13:45 +00:00
|
|
|
.It Fl p
|
|
|
|
Preserve mode, timestamp and permissions.
|
|
|
|
.It Fl v
|
2015-03-02 18:15:19 +00:00
|
|
|
Write "'source' -> 'dest'" for each
|
|
|
|
.Ar source
|
|
|
|
to stdout.
|
2015-02-09 21:11:06 +00:00
|
|
|
.It Fl H
|
2015-03-02 18:15:19 +00:00
|
|
|
Dereference
|
|
|
|
.Ar source
|
|
|
|
if it is a symbolic link.
|
2015-02-09 21:11:06 +00:00
|
|
|
.It Fl L
|
2015-03-02 18:15:19 +00: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 05:08:36 +00:00
|
|
|
This is the default without
|
|
|
|
.Fl R .
|
2015-01-30 21:07:17 +00:00
|
|
|
.It Fl P
|
2015-03-02 18:15:19 +00: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 05:08:36 +00:00
|
|
|
This is the default with
|
|
|
|
.Fl R .
|
2015-03-02 18:15:19 +00:00
|
|
|
.It Fl R
|
2020-03-01 22:37:31 +00:00
|
|
|
Traverse directories recursively.
|
|
|
|
If this flag is not specified, directories are not copied.
|
2015-01-30 21:07:17 +00:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr mv 1
|
2015-03-02 18:15:19 +00:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is compliant with the
|
2015-03-27 16:22:48 +00:00
|
|
|
.St -p1003.1-2013
|
2015-03-02 18:15:19 +00:00
|
|
|
specification except from the
|
|
|
|
.Op Fl i
|
|
|
|
flag.
|
|
|
|
.Pp
|
2015-03-27 16:22:48 +00:00
|
|
|
The
|
2015-03-02 18:15:19 +00:00
|
|
|
.Op Fl av
|
2015-03-27 16:22:48 +00:00
|
|
|
flags are an extension to that specification.
|