cp(1)
β¨ NAME β¨
okay bestie, meet cp β the section 1 (General Commands Manual) icon whose whole job is: Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. that's it. that's the girl. π
πΈ SYNOPSIS πΈ
cp [-t|--target-directory] [-T|--no-target-directory] [-i|--interactive]
[-l|--link] [-n|--no-clobber] [-R|--recursive]
[--strip-trailing-slashes] [--debug] [-v|--verbose] [-s|--symbolic-link]
[-f|--force] [--remove-destination] [--backup] [-b ] [-S|--suffix]
[--update] [-u ] [--reflink] [--attributes-only] [--preserve]
[-p|--preserve-default-attributes] [--no-preserve] [--parents]
[-P|--no-dereference] [-L|--dereference] [-H ] [-a|--archive] [-d ]
[-x|--one-file-system] [--sparse] [-Z ] [--context] [-g|--progress]
[--copy-contents] [-h|--help] [-V|--version] <paths>
π DESCRIPTION π
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. that's the whole vibe. no cap. π¦
π OPTIONS π
the way there are so many of theseβ¦ every single one is here, don't worry, i would never gatekeep π«Ά
-t,--target-directory<target-directory>β copy every single SOURCE argument into target-directory like it's the group chat and everyone's getting dropped in at once π¬-T,--no-target-directoryβ treat DEST as a regular file, not a directory. she said "i'm a file, actually" β-i,--interactiveβ asks you before overwriting files. consent king behavior π-l,--linkβ hard-links the files instead of copying them. no duplicate data, just vibes β¨-n,--no-clobberβ if a file already exists, don't overwrite it. leave her alone!! π-R,--recursiveβ copy directories recursively, all the way down, like going through your camera roll from 2019 π--strip-trailing-slashesβ removes any trailing slashes from each SOURCE argument. little cleanup moment π§Ή--debugβ explains how a file is copied. Implies-v. she's narrating her own life π-v,--verboseβ explicitly states what is being done. main character commentary π€-s,--symbolic-linkβ makes symbolic links instead of copying. it's giving "close enough" π«-f,--forceβ if an existing destination file can't be opened, it removes it and tries again. (heads up: this option is ignored when the-noption is also used. Currently not implemented for Windows.)--remove-destinationβ removes each existing destination file before attempting to open it (contrast with--force). On Windows, currently only works for writeable files.--backup[=<CONTROL>]β makes a backup of each existing destination file. safety net era π-bβ like--backupbut it does not accept an argument-S,--suffix<SUFFIX>β overrides the usual backup suffix, you pick your own flair π--updateβ move only when the SOURCE file is newer than the destination file, or when the destination file is missing
possible values:
nonealloldernone-fail
-uβ like--updatebut does not accept an argument--reflink[=<WHEN>]β controls clone/CoW copies. See below π
possible values:
autoalwaysnever
--attributes-onlyβ don't copy the file data, just the attributes. personality, no plot π--preserve[=<ATTR_LIST>...]β preserve the specified attributes (default:mode,ownership(unix only),timestamps), and if possible these additional attributes:context,links,xattr,all
possible values:
modeownershiptimestampscontextlinksxattrall
-p,--preserve-default-attributesβ same as--preserve=mode,ownership(unix only),timestamps--no-preserve[=<ATTR_LIST>...]β don't preserve the specified attributes
possible values:
modeownershiptimestampscontextlinksxattrall
--parentsβ use the full source file name under DIRECTORY. she brought her whole family π³-P,--no-dereferenceβ never follow symbolic links in SOURCE. mind your business π«-L,--dereferenceβ always follow symbolic links in SOURCE. nosy on purpose π-Hβ follow command-line symbolic links in SOURCE-a,--archiveβ Same as-dR --preserve=all. the everything bagel π₯―-dβ same as--no-dereference --preserve=links-x,--one-file-systemβ stay on this file system. no crossing borders π--sparse<WHEN>β control creation of sparse files. See below
possible values:
neverautoalways
-Zβ set SELinux security context of destination file to default type--context[=<CTX>]β like-Z, or if CTX is specified then set the SELinux or SMACK security context to CTX-g,--progressβ Display a progress bar. Note: this feature is not supported by GNU coreutils.--copy-contentsβ NotImplemented: copy contents of special files when recursive-h,--helpβ Print help-V,--versionβ Print version<paths>
π¦ EXTRA π¦
okay so this next bit, don't copy a non-directory that has an existing destination with the same or newer modification timestamp β instead, silently skip the file without failing. quiet quitting, honestly π
if timestamps are being preserved, the comparison is to the source timestamp truncated to the resolutions of the destination file system and of the system calls used to update timestamps. why? to avoid duplicate work if several cp -pu commands are executed with the same source and destination. efficiency queen β¨
this option is ignored if the -n or --no-clobber option is also specified. also, if --preserve=links is also specified (like with cp -au for example), that will take precedence; consequently, depending on the order that files are processed from the source, newer files in the destination may be replaced, to mirror hard links in the source.
then the original text just kindaβ¦ mid-sentence starts with "which gives more control over which existing files in the destination are replaced, and its value can be one of the following:" β bestie i'm telling you this exactly as she wrote it, no notes π anyway:
allβ This is the default operation when an--updateoption is not specified, and results in all existing files in the destination being replaced.noneβ This is similar to the--no-clobberoption, in that no files in the destination are replaced, but also skipping a file does not induce a failure.olderβ This is the default operation when--updateis specified, and results in files being replaced if they're older than the corresponding source file.
the backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. the version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. here are the values, memorise them, there will be a quiz π:
none,offβ never make backups (even if--backupis given)numbered,tβ make numbered backupsexisting,nilβ numbered if numbered backups exist, simple otherwisesimple,neverβ always make simple backups
π VERSION π
v(uutils coreutils) 0.7.0
and that's the whole page, bestie π«Ά this was cp from the General Commands Manual, and it's from cp (uutils coreutils) 0.7.0 β the uutils coreutils girlies did that, 0.7.0 era, iconic, periodt πβ¨π go copy something.
π¦ where this page comes from
- epel 10: rust-coreutils-devel 0.7.0-10.el10_3 Β· MIT
- epel 10: uutils-coreutils 0.7.0-10.el10_3 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- fedora 43: rust-coreutils-devel 0.7.0-12.fc43 Β· MIT
- fedora 43: uutils-coreutils 0.7.0-12.fc43 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms