cp(1)

πŸ“¦
version 0.7.0 Β· 4 versions
, in epel 10, fedora 43

✨ 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 -n option 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 --backup but 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:

  • none
  • all
  • older
  • none-fail
  • -u β€” like --update but does not accept an argument
  • --reflink[=<WHEN>] β€” controls clone/CoW copies. See below πŸ‘€

possible values:

  • auto
  • always
  • never
  • --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:

  • mode
  • ownership
  • timestamps
  • context
  • links
  • xattr
  • all
  • -p, --preserve-default-attributes β€” same as --preserve=mode,ownership(unix only),timestamps
  • --no-preserve[=<ATTR_LIST>...] β€” don't preserve the specified attributes

possible values:

  • mode
  • ownership
  • timestamps
  • context
  • links
  • xattr
  • all
  • --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:

  • never
  • auto
  • always
  • -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 --update option is not specified, and results in all existing files in the destination being replaced.
  • none β€” This is similar to the --no-clobber option, 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 --update is 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 --backup is given)
  • numbered, t β€” make numbered backups
  • existing, nil β€” numbered if numbered backups exist, simple otherwise
  • simple, 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