{"id":302,"date":"2019-10-21T19:40:46","date_gmt":"2019-10-21T17:40:46","guid":{"rendered":"http:\/\/linuxboxen2.dk\/?p=302"},"modified":"2019-10-21T19:40:46","modified_gmt":"2019-10-21T17:40:46","slug":"org_cp","status":"publish","type":"post","link":"https:\/\/www.linuxboxen.dk\/?p=302","title":{"rendered":"CP"},"content":{"rendered":"<p>cp &#8211; copy files and directories<\/p>\n<h2>Synopsis<\/h2>\n<p><strong>cp<\/strong>\u00a0[<em>OPTION<\/em>]&#8230; [<em>-T<\/em>]\u00a0<em>SOURCE DEST<\/em><br \/>\n<strong>cp<\/strong>\u00a0[<em>OPTION<\/em>]&#8230;\u00a0<em>SOURCE<\/em>&#8230;\u00a0<em>DIRECTORY<\/em><br \/>\n<strong>cp<\/strong>\u00a0[<em>OPTION<\/em>]&#8230;\u00a0<em>-t DIRECTORY SOURCE<\/em>&#8230;<\/p>\n<h2>Description<\/h2>\n<p>Copy SOURCE to DEST, or multiple\u00a0<strong>SOURCE<\/strong>(s) to DIRECTORY.<\/p>\n<p>Mandatory arguments to long options are mandatory for short options too.<\/p>\n<dl>\n<dt><strong>-a<\/strong>,\u00a0<strong>&#8211;archive<\/strong><\/dt>\n<dd>same as\u00a0<strong>-dR &#8211;preserve<\/strong>=<em>all<\/em><\/dd>\n<dt><strong>&#8211;backup<\/strong>[=<em>CONTROL<\/em>]<\/dt>\n<dd>make a backup of each existing destination file<\/dd>\n<dt><strong>-b<\/strong><\/dt>\n<dd>like\u00a0<strong>&#8211;backup<\/strong>\u00a0but does not accept an argument<\/dd>\n<dt><strong>&#8211;copy-contents<\/strong><\/dt>\n<dd>copy contents of special files when recursive<\/dd>\n<dt><strong>-d<\/strong><\/dt>\n<dd>same as\u00a0<strong>&#8211;no-dereference &#8211;preserve<\/strong>=<em>links<\/em><\/dd>\n<dt><strong>-f<\/strong>,\u00a0<strong>&#8211;force<\/strong><\/dt>\n<dd>if an existing destination file cannot be opened, remove it and try again (redundant if the\u00a0<strong>-n<\/strong>\u00a0option is used)<\/dd>\n<dt><strong>-i<\/strong>,\u00a0<strong>&#8211;interactive<\/strong><\/dt>\n<dd>prompt before overwrite (overrides a previous\u00a0<strong>-n<\/strong>\u00a0option)<\/dd>\n<dt><strong>-H<\/strong><\/dt>\n<dd>follow command-line symbolic links in SOURCE<\/dd>\n<dt><strong>-l<\/strong>,\u00a0<strong>&#8211;link<\/strong><\/dt>\n<dd>link files instead of copying<\/dd>\n<dt><strong>-L<\/strong>,\u00a0<strong>&#8211;dereference<\/strong><\/dt>\n<dd>always follow symbolic links in SOURCE<\/dd>\n<dt><strong>-n<\/strong>,\u00a0<strong>&#8211;no-clobber<\/strong><\/dt>\n<dd>do not overwrite an existing file (overrides a previous\u00a0<strong>-i<\/strong>\u00a0option)<\/dd>\n<dt><strong>-P<\/strong>,\u00a0<strong>&#8211;no-dereference<\/strong><\/dt>\n<dd>never follow symbolic links in SOURCE<\/dd>\n<dt><strong>-p<\/strong><\/dt>\n<dd>same as\u00a0<strong>&#8211;preserve<\/strong>=<em>mode<\/em>,ownership,timestamps<\/dd>\n<dt><strong>&#8211;preserve<\/strong>[=<em>ATTR_LIST<\/em>]<\/dt>\n<dd>preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all<\/dd>\n<dt><strong>-c<\/strong><\/dt>\n<dd>same as\u00a0<strong>&#8211;preserve<\/strong>=<em>context<\/em><\/dd>\n<dt><strong>&#8211;no-preserve<\/strong>=<em>ATTR_LIST<\/em><\/dt>\n<dd>don&#8217;t preserve the specified attributes<\/dd>\n<dt><strong>&#8211;parents<\/strong><\/dt>\n<dd>use full source file name under DIRECTORY<\/dd>\n<dt><strong>-R<\/strong>,\u00a0<strong>-r<\/strong>,\u00a0<strong>&#8211;recursive<\/strong><\/dt>\n<dd>copy directories recursively<\/dd>\n<dt><strong>&#8211;reflink<\/strong>[=<em>WHEN<\/em>]<\/dt>\n<dd>control clone\/CoW copies. See below.<\/dd>\n<dt><strong>&#8211;remove-destination<\/strong><\/dt>\n<dd>remove each existing destination file before attempting to open it (contrast with\u00a0<strong>&#8211;force<\/strong>)<\/dd>\n<dt><strong>&#8211;sparse<\/strong>=<em>WHEN<\/em><\/dt>\n<dd>control creation of sparse files. See below.<\/dd>\n<dt><strong>&#8211;strip-trailing-slashes<\/strong><\/dt>\n<dd>remove any trailing slashes from each SOURCE argument<\/dd>\n<dt><strong>-s<\/strong>,\u00a0<strong>&#8211;symbolic-link<\/strong><\/dt>\n<dd>make symbolic links instead of copying<\/dd>\n<dt><strong>-S<\/strong>,\u00a0<strong>&#8211;suffix<\/strong>=<em>SUFFIX<\/em><\/dt>\n<dd>override the usual backup suffix<\/dd>\n<dt><strong>-t<\/strong>,\u00a0<strong>&#8211;target-directory<\/strong>=<em>DIRECTORY<\/em><\/dt>\n<dd>copy all SOURCE arguments into DIRECTORY<\/dd>\n<dt><strong>-T<\/strong>,\u00a0<strong>&#8211;no-target-directory<\/strong><\/dt>\n<dd>treat DEST as a normal file<\/dd>\n<dt><strong>-u<\/strong>,\u00a0<strong>&#8211;update<\/strong><\/dt>\n<dd>copy only when the SOURCE file is newer than the destination file or when the destination file is missing<\/dd>\n<dt><strong>-v<\/strong>,\u00a0<strong>&#8211;verbose<\/strong><\/dt>\n<dd>explain what is being done<\/dd>\n<dt><strong>-x<\/strong>,\u00a0<strong>&#8211;one-file-system<\/strong><\/dt>\n<dd>stay on this file system<\/dd>\n<dt><strong>-Z<\/strong>,\u00a0<strong>&#8211;context<\/strong>=<em>CONTEXT<\/em><\/dt>\n<dd>set security context of copy to CONTEXT<\/dd>\n<dt><strong>&#8211;help<\/strong><\/dt>\n<dd>display this help and exit<\/dd>\n<dt><strong>&#8211;version<\/strong><\/dt>\n<dd>output version information and exit<\/dd>\n<\/dl>\n<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\u00a0<strong>&#8211;sparse<\/strong>=<em>auto<\/em>. Specify\u00a0<strong>&#8211;sparse<\/strong>=<em>always<\/em>\u00a0to create a sparse DEST file whenever the SOURCE file contains a long enough sequence of zero bytes. Use\u00a0<strong>&#8211;sparse<\/strong>=<em>never<\/em>\u00a0to inhibit creation of sparse files.<\/p>\n<p>When\u00a0<strong>&#8211;reflink<\/strong>[=<em>always<\/em>] 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\u00a0<strong>&#8211;reflink<\/strong>=<em>auto<\/em>\u00a0is specified, fall back to a standard copy.<\/p>\n<p>The backup suffix is &#8216;~&#8217;, unless set with\u00a0<strong>&#8211;suffix<\/strong>\u00a0or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the\u00a0<strong>&#8211;backup<\/strong>\u00a0option or through the VERSION_CONTROL environment variable. Here are the values:<\/p>\n<dl>\n<dt>none, off<\/dt>\n<dd>never make backups (even if\u00a0<strong>&#8211;backup<\/strong>\u00a0is given)<\/dd>\n<dt>numbered, t<\/dt>\n<dd>make numbered backups<\/dd>\n<dt>existing, nil<\/dt>\n<dd>numbered if numbered backups exist, simple otherwise<\/dd>\n<dt>simple, never<\/dt>\n<dd>always make simple backups<\/dd>\n<\/dl>\n<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.<\/p>\n<h2>Author<\/h2>\n<p>Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.<\/p>\n<h2>Reporting Bugs<\/h2>\n<p>Report cp bugs to\u00a0<a href=\"mailto:bug-coreutils@gnu.org\">bug-coreutils@gnu.org<\/a><br \/>\nGNU coreutils home page: &lt;<a href=\"https:\/\/www.gnu.org\/software\/coreutils\/\">http:\/\/www.gnu.org\/software\/coreutils\/<\/a>&gt;<br \/>\nGeneral help using GNU software: &lt;<a href=\"https:\/\/www.gnu.org\/gethelp\/\">http:\/\/www.gnu.org\/gethelp\/<\/a>&gt;<br \/>\nReport cp translation bugs to &lt;<a href=\"https:\/\/translationproject.org\/team\/\">http:\/\/translationproject.org\/team\/<\/a>&gt;<\/p>\n<h2>Copyright<\/h2>\n<p>Copyright \u00c2\u00a9 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;<a href=\"https:\/\/gnu.org\/licenses\/gpl.html\">http:\/\/gnu.org\/licenses\/gpl.html<\/a>&gt;.<br \/>\nThis is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.<\/p>\n<h2>See Also<\/h2>\n<p>The full documentation for\u00a0<strong>cp<\/strong>\u00a0is maintained as a Texinfo manual. If the\u00a0<strong>info<\/strong>\u00a0and\u00a0<strong>cp<\/strong>\u00a0programs are properly installed at your site, the command<\/p>\n<dl>\n<dt><strong>info coreutils aqcp invocationaq<\/strong><\/dt>\n<\/dl>\n<p>should give you access to the complete manual.<\/p>\n<h2>Referenced By<\/h2>\n<p><strong><a href=\"https:\/\/linux.die.net\/man\/5\/acl\">acl<\/a><\/strong>(5),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/cpdup\">cpdup<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/7\/cpuset\">cpuset<\/a><\/strong>(7),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/dccp\">dccp<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/enconv\">enconv<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/3\/gdbm\">gdbm<\/a><\/strong>(3),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/memcp\">memcp<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/mirrordir\">mirrordir<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/mksh\">mksh<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/8\/mkswap\">mkswap<\/a><\/strong>(8),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/8\/rbldnsd\">rbldnsd<\/a><\/strong>(8),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/rcp\">rcp<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/rdup-cp\">rdup-cp<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/8\/rdup-cp\">rdup-cp<\/a><\/strong>(8),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/rdup-snap\">rdup-snap<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/8\/rdup-snap\">rdup-snap<\/a><\/strong>(8),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/rsnapshot\">rsnapshot<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/rsync\">rsync<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/spax\">spax<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/7\/symlink\">symlink<\/a><\/strong>(7),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/vcp\">vcp<\/a><\/strong>(1),\u00a0<strong><a href=\"https:\/\/linux.die.net\/man\/1\/virt-sysprep\">virt-sysprep<\/a><\/strong>(1)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>cp &#8211; copy files and directories Synopsis cp\u00a0[OPTION]&#8230; [-T]\u00a0SOURCE DEST cp\u00a0[OPTION]&#8230;\u00a0SOURCE&#8230;\u00a0DIRECTORY cp\u00a0[OPTION]&#8230;\u00a0-t DIRECTORY SOURCE&#8230; Description Copy SOURCE to DEST, or multiple\u00a0SOURCE(s) to DIRECTORY. Mandatory arguments to long options are mandatory for short options too. -a,\u00a0&#8211;archive same as\u00a0-dR &#8211;preserve=all &#8211;backup[=CONTROL] make a backup of each existing destination file -b like\u00a0&#8211;backup\u00a0but does not accept an argument &#8211;copy-contents [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-302","post","type-post","status-publish","format-standard","hentry","category-shell"],"_links":{"self":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=302"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/302\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}