CP(1)
๐ CP(1) โ the copy command, but make it fashion ๐
okay bestie, pull up a chair, because today we're learning cp(1) from the User Commands section of the manual, and honestly? it's giving main character energy. this is the girl who moves your files around, and she has opinions. ๐ซถ
โจ NAME โจ
cp โ copy files and directories ๐ฆ
โจ SYNOPSIS โจ
cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
โจ DESCRIPTION โจ
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. that's it, that's the vibe. one file, or a whole little squad of files into a folder. ๐
โ ๏ธ real talk: mandatory arguments to long options are mandatory for short options too. no exceptions, no cap. if you skip an argument an option needs, she's not gonna guess for you. ๐ญ
๐ the flags, one by one, we're not skipping a single one ๐
-a,--archiveโ same as-dR --preserve=all. the full-glam, everything-preserved copy.--attributes-onlyโ don't copy the file data, just the attributes. the vibe without the contents, lowkey unhinged but valid.--backup[=CONTROL]โ make a backup of each existing destination file.-bโ like--backupbut does not accept an argument. short and sweet, no extra input.--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's narrating her own life. ๐-f,--forceโ if an existing destination file cannot be opened, remove it and try again. heads up: this option is ignored when the-noption is also used.-i,--interactiveโ prompt before overwrite. this one overrides a previous-noption. she asks first, like a respectful queen. ๐-Hโ follow command-line symbolic links in SOURCE.-L,--dereferenceโ always follow symbolic links in SOURCE.-P,--no-dereferenceโ never follow symbolic links in SOURCE.--keep-directory-symlinkโ follow existing symlinks to directories.-l,--linkโ hard link files instead of copying.-n,--no-clobberโ (deprecated) silently skip existing files. See also--update. yeah girl she's on her way out, use--updateinstead fr fr.-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 under DIRECTORY.-R,-r,--recursiveโ copy directories recursively. the whole tree, babes ๐ธ--reflink[=WHEN]โ control clone/CoW copies. See below. ๐--remove-destinationโ remove each existing destination file before attempting to open it (contrast with--force).--sparse=WHENโ control creation of sparse files. See below. ๐--strip-trailing-slashesโ remove any trailing slashes from each SOURCE argument. little cleanup moment. โจ-s,--symbolic-linkโ make symbolic links instead of copying.-S,--suffix=SUFFIXโ override the usual backup suffix.-t,--target-directory=DIRECTORYโ copy all SOURCE arguments into DIRECTORY.-T,--no-target-directoryโ treat DEST as 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 keeping you in the loop, bestie. ๐ฌ-x,--one-file-systemโ stay on this file system. no wandering off. ๐ซ-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.--helpโ display this help and exit.--versionโ output version information and exit.
๐ง what even is ATTR_LIST ๐ง
ATTR_LIST is a comma-separated list of attributes. 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
๐ซง sparse files, the whole tea ๐ซง
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, and which files get replaced ๐ซ
UPDATE controls which existing files in the destination are replaced.
'all'is the default operation when an--updateoption is not specified, and results in all existing files in the destination being replaced.'none'is 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 do induce a failure.'older'is the default operation when--updateis specified, and results in files being replaced if they're older than the corresponding source file.
๐ reflink, the CoW of it all ๐
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 + suffixes ๐
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
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. plot twist, but a documented one. ๐
โจ AUTHOR โจ
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering. legends, all three. ๐
โจ REPORTING BUGS โจ
- Report bugs to:
bug-coreutils@gnu.org. - Report any translation bugs to:
https://translationproject.org/team/. - GNU coreutils home page:
https://www.gnu.org/software/coreutils/ - General help using GNU software:
https://www.gnu.org/gethelp/
โจ COPYRIGHT โจ
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. like, none. zero. she said what she said. ๐
โจ SEE ALSO โจ
install(1)- Full documentation
https://www.gnu.org/software/coreutils/cpor available locally via:info '(coreutils) cp invocation'
and that's the whole page, bestie, we ate and left no crumbs. ๐
โจ this lil masterpiece is GNU coreutils 9.12, dated September 2026, and yes the page header said CP(1) and the footer said CP(1) too, so we're full circle. mwah. ๐ซถ๐
๐ฆ where this page comes from
- arch rolling: coreutils 9.12-2 ยท GPL-3.0-or-later AND GFDL-1.3-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms