man-pages/man1/cp.1.html
2021-03-31 01:06:50 +01:00

200 lines
6.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CP</TITLE>
</HEAD><BODY>
<H1>CP</H1>
Section: User Commands (1)<BR>Updated: September 2019<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
cp - copy files and directories
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>cp</B>
[<I>,OPTION/</I>]... [<I>,-T/</I>] <I>,SOURCE DEST/</I>
<BR>
<B>cp</B>
[<I>,OPTION/</I>]... <I>,SOURCE/</I>... <I>,DIRECTORY/</I>
<BR>
<B>cp</B>
[<I>,OPTION/</I>]... <I>,-t DIRECTORY SOURCE/</I>...
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
<P>
Mandatory arguments to long options are mandatory for short options too.
<DL COMPACT>
<DT id="1"><B>-a</B>, <B>--archive</B><DD>
same as <B>-dR</B> <B>--preserve</B>=<I>,all/</I>
<DT id="2"><B>--attributes-only</B><DD>
don't copy the file data, just the attributes
<DT id="3"><B>--backup</B>[=<I>,CONTROL/</I>]<DD>
make a backup of each existing destination file
<DT id="4"><B>-b</B><DD>
like <B>--backup</B> but does not accept an argument
<DT id="5"><B>--copy-contents</B><DD>
copy contents of special files when recursive
<DT id="6"><B>-d</B><DD>
same as <B>--no-dereference</B> <B>--preserve</B>=<I>,links/</I>
<DT id="7"><B>-f</B>, <B>--force</B><DD>
if an existing destination file cannot be
opened, remove it and try again (this option
is ignored when the <B>-n</B> option is also used)
<DT id="8"><B>-i</B>, <B>--interactive</B><DD>
prompt before overwrite (overrides a previous <B>-n</B>
option)
<DT id="9"><B>-H</B><DD>
follow command-line symbolic links in SOURCE
<DT id="10"><B>-l</B>, <B>--link</B><DD>
hard link files instead of copying
<DT id="11"><B>-L</B>, <B>--dereference</B><DD>
always follow symbolic links in SOURCE
<DT id="12"><B>-n</B>, <B>--no-clobber</B><DD>
do not overwrite an existing file (overrides
a previous <B>-i</B> option)
<DT id="13"><B>-P</B>, <B>--no-dereference</B><DD>
never follow symbolic links in SOURCE
<DT id="14"><B>-p</B><DD>
same as <B>--preserve</B>=<I>,mode/</I>,ownership,timestamps
<DT id="15"><B>--preserve</B>[=<I>,ATTR_LIST/</I>]<DD>
preserve the specified attributes (default:
mode,ownership,timestamps), if possible
additional attributes: context, links, xattr,
all
<DT id="16"><B>--no-preserve</B>=<I>,ATTR_LIST/</I><DD>
don't preserve the specified attributes
<DT id="17"><B>--parents</B><DD>
use full source file name under DIRECTORY
<DT id="18"><B>-R</B>, <B>-r</B>, <B>--recursive</B><DD>
copy directories recursively
<DT id="19"><B>--reflink</B>[=<I>,WHEN/</I>]<DD>
control clone/CoW copies. See below
<DT id="20"><B>--remove-destination</B><DD>
remove each existing destination file before
attempting to open it (contrast with <B>--force</B>)
<DT id="21"><B>--sparse</B>=<I>,WHEN/</I><DD>
control creation of sparse files. See below
<DT id="22"><B>--strip-trailing-slashes</B><DD>
remove any trailing slashes from each SOURCE
argument
<DT id="23"><B>-s</B>, <B>--symbolic-link</B><DD>
make symbolic links instead of copying
<DT id="24"><B>-S</B>, <B>--suffix</B>=<I>,SUFFIX/</I><DD>
override the usual backup suffix
<DT id="25"><B>-t</B>, <B>--target-directory</B>=<I>,DIRECTORY/</I><DD>
copy all SOURCE arguments into DIRECTORY
<DT id="26"><B>-T</B>, <B>--no-target-directory</B><DD>
treat DEST as a normal file
<DT id="27"><B>-u</B>, <B>--update</B><DD>
copy only when the SOURCE file is newer
than the destination file or when the
destination file is missing
<DT id="28"><B>-v</B>, <B>--verbose</B><DD>
explain what is being done
<DT id="29"><B>-x</B>, <B>--one-file-system</B><DD>
stay on this file system
<DT id="30"><B>-Z</B><DD>
set SELinux security context of destination
file to default type
<DT id="31"><B>--context</B>[=<I>,CTX/</I>]<DD>
like <B>-Z</B>, or if CTX is specified then set the
SELinux or SMACK security context to CTX
<DT id="32"><B>--help</B><DD>
display this help and exit
<DT id="33"><B>--version</B><DD>
output version information and exit
</DL>
<P>
By default, sparse SOURCE files are detected by a crude heuristic and the
corresponding DEST file is made sparse as well. That is the behavior
selected by <B>--sparse</B>=<I>,auto/</I>. Specify <B>--sparse</B>=<I>,always/</I> to create a sparse DEST
file whenever the SOURCE file contains a long enough sequence of zero bytes.
Use <B>--sparse</B>=<I>,never/</I> to inhibit creation of sparse files.
<P>
When <B>--reflink</B>[=<I>,always/</I>] is specified, perform a lightweight copy, where the
data blocks are copied only when modified. If this is not possible the copy
fails, or if <B>--reflink</B>=<I>,auto/</I> is specified, fall back to a standard copy.
Use <B>--reflink</B>=<I>,never/</I> to ensure a standard copy is performed.
<P>
The backup suffix is '~', unless set with <B>--suffix</B> or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the <B>--backup</B> option or through
the VERSION_CONTROL environment variable. Here are the values:
<DL COMPACT>
<DT id="34">none, off<DD>
never make backups (even if <B>--backup</B> is given)
<DT id="35">numbered, t<DD>
make numbered backups
<DT id="36">existing, nil<DD>
numbered if numbered backups exist, simple otherwise
<DT id="37">simple, never<DD>
always make simple backups
</DL>
<P>
As a special case, cp makes a backup of SOURCE when the force and backup
options are given and SOURCE and DEST are the same name for an existing,
regular file.
<A NAME="lbAE">&nbsp;</A>
<H2>AUTHOR</H2>
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
<A NAME="lbAF">&nbsp;</A>
<H2>REPORTING BUGS</H2>
GNU coreutils online help: &lt;<A HREF="https://www.gnu.org/software/coreutils/">https://www.gnu.org/software/coreutils/</A>&gt;
<BR>
Report cp translation bugs to &lt;<A HREF="https://translationproject.org/team/">https://translationproject.org/team/</A>&gt;
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright &#169; 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;<A HREF="https://gnu.org/licenses/gpl.html">https://gnu.org/licenses/gpl.html</A>&gt;.
<BR>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
Full documentation at: &lt;<A HREF="https://www.gnu.org/software/coreutils/cp">https://www.gnu.org/software/coreutils/cp</A>&gt;
<BR>
or available locally via: info '(coreutils) cp invocation'
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="38"><A HREF="#lbAB">NAME</A><DD>
<DT id="39"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="40"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="41"><A HREF="#lbAE">AUTHOR</A><DD>
<DT id="42"><A HREF="#lbAF">REPORTING BUGS</A><DD>
<DT id="43"><A HREF="#lbAG">COPYRIGHT</A><DD>
<DT id="44"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:09 GMT, March 31, 2021
</BODY>
</HTML>