CP(1)
π NAME π
okay bestie, listen up β this is cp(1), the copy files and directories girlie of the GNU coreutils lineup. she's been doing this since forever and she EATS every time. π«Ά
β¨ SYNOPSIS β¨
cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
πΈ DESCRIPTION πΈ
so the whole vibe is: copy SOURCE to DEST, or copy a whole bunch of SOURCE(s) into a DIRECTORY. that's it. that's the job. iconic. π
heads up bestie: mandatory arguments to long options are also mandatory for the short options. so if the long one needs a value, the short one does too. no skipping. β
the options, in order, all of them, no crumbs left behind π
-a,--archiveβ literally the same as-dR --preserve=all. the full-preservation combo meal. π--attributes-onlyβ don't copy the file data, just the attributes. personality only, no content. ngl it's giving "vibes but no substance" but make it intentional.--backup[=CONTROL]β make a backup of every existing destination file.-bβ like--backupbut she does not accept an argument. strict queen.--copy-contentsβ copy contents of special files when recursive.-dβ same as--no-dereference --preserve=links.--debugβ explain how a file is copied. implies-v. she narrates her own life, main character energy fr.-f,--forceβ if an existing destination file can't be opened, remove it and try again. (this option is ignored when the-noption is also used, fyi)-i,--interactiveβ prompt before overwrite. (overrides a previous-noption β yes she will ask, she's polite like that π)-Hβ follow command-line symbolic links inSOURCE.-L,--dereferenceβ always follow symbolic links inSOURCE. zero fear, she goes where they point. π-P,--no-dereferenceβ never follow symbolic links inSOURCE. she does NOT chase, she observes. π--keep-directory-symlinkβ follow existing symlinks to directories.-l,--linkβ hard link files instead of copying. why copy when you can just ~link~ besties.-n,--no-clobberβ (deprecated) do not overwrite an existing file and do not fail. (overrides a-uor previous-ioption). see also--update; equivalent to--update=none.-pβ same as--preserve=mode,ownership,timestamps.--preserve[=ATTR_LIST]β preserve the specified attributes.--no-preserve=ATTR_LISTβ don't preserve the specified attributes.--parentsβ use full source file name underDIRECTORY.-R,-r,--recursiveβ copy directories recursively. down the rabbit hole we go π--reflink[=WHEN]β control clone/CoW copies. see below.--remove-destinationβ remove each existing destination file before attempting to open it. (contrast with--force) β she's thorough, okay?!--sparse=WHENβ control creation of sparse files. see below.--strip-trailing-slashesβ remove any trailing slashes from eachSOURCEargument. de-cluttering, we love to see it.-s,--symbolic-linkβ make symbolic links instead of copying.-S,--suffix=SUFFIXβ override the usual backup suffix.-t,--target-directory=DIRECTORYβ copy allSOURCEarguments intoDIRECTORY.-T,--no-target-directoryβ treatDESTas a normal file.--update[=UPDATE]β control which existing files are updated;UPDATE={all,none,none-fail,older(default)}.-uβ equivalent to--update[=older]. see below.-v,--verboseβ explain what is being done. she's a yapper and honestly? we need that. π£οΈ-x,--one-file-systemβ stay on this file system. no crossing boundaries, she has her limits.-Zβ set SELinux security context of destination file to default type.--context[=CTX]β like-Z, or ifCTXis specified then set the SELinux or SMACK security context toCTX.--helpβ display this help and exit.--versionβ output version information and exit.
okay lore time π
ATTR_LIST is a comma-separated list of attributes. and the attributes are:
modeβ for permissions (including any ACL and xattr permissions)ownershipβ for user and grouptimestampsβ for file timestampslinksβ for hard linkscontextβ for security contextxattrβ for extended attributesallβ for all attributes
the sparse files situation π¦
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 --sparse=auto. Specify --sparse=always to create a sparse DEST file whenever the SOURCE file contains a long enough sequence of zero bytes. Use --sparse=never to inhibit creation of sparse files.
UPDATE, explained π
UPDATE controls which existing files in the destination are replaced:
allβ the default operation when an--updateoption is not specified, and results in all existing files in the destination being replaced.noneβ like the--no-clobberoption, in that no files in the destination are replaced, and skipped files do not induce a failure.none-failβ also ensures no files are replaced in the destination, but any skipped files are diagnosed and induce a failure.olderβ the default operation when--updateis specified, and results in files being replaced if they're older than the corresponding source file.
reflink deep dive π§
By default or with --reflink=auto, cp will try a lightweight copy, where the data blocks are copied only when modified, falling back to a standard copy if this is not possible. With --reflink[=always] cp will fail if CoW is not supported, while --reflink=never ensures a standard copy is performed.
backups, the whole tea β
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:
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
one special little exception π
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.
π AUTHOR π
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering. legends, honestly. thank you for your service π«‘
π REPORTING BUGS π
- Report bugs to:
bug-coreutils@gnu.org - GNU coreutils home page:
https://www.gnu.org/software/coreutils/ - General help using GNU software:
https://www.gnu.org/gethelp/ - Report any translation bugs to
https://translationproject.org/team/
π SEE ALSO π
install(1)- Full documentation
https://www.gnu.org/software/coreutils/cpβ or available locally via:info '(coreutils) cp invocation' - Packaged by Ubuntu (
9.10-1ubuntu2) - Copyright Β© 2026 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later
https://gnu.org/licenses/gpl.html. - This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
okay that's the whole thing bestie, you're officially a cp girlie now π
β¨ go forth and copy responsibly β this was GNU coreutils 9.10, August 2026, CP(1), and she ATE. mwah! πππ¦
π¦ where this page comes from
- ubuntu stonking: gnu-coreutils 9.10-1ubuntu2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms