CP(1)
π
CP(1) β bestie, meet cp π
okay so this is the manual page for cp, from the General Commands Manual. it copies stuff. that's the whole vibe. let's go π¦
β¨ NAME β¨
cp β Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
πΈ 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 whole description. iconic, honestly. π
π₯ OPTIONS π₯
-t,--target-directory <target-directory>β copy all SOURCE arguments into target-directory β¨-T,--no-target-directoryβ Treat DEST as a regular file and not a directory. like, pls stop assuming things π-i,--interactiveβ ask before overwriting files. consent first, always π«Ά-l,--linkβ hard-link files instead of copying-n,--no-clobberβ don't overwrite a file that already exists. leave it alone, it's doing its best π-R,--recursiveβ copy directories recursively. yes, all the way down, we're going in π³οΈ--strip-trailing-slashesβ remove any trailing slashes from each SOURCE argument--debugβ explain how a file is copied. Implies-v. it's giving narrator energy-v,--verboseβ explicitly state what is being done-s,--symbolic-linkβ make symbolic links instead of copying-f,--forceβ if an existing destination file cannot be opened, remove it and try again (this option is ignored when the-noption is also used). Currently not implemented for Windows.--remove-destinationβ remove each existing destination file before attempting to open it (contrast with--force). On Windows, currently only works for writeable files.--backup[=<CONTROL>]β make a backup of each existing destination file π-bβ like--backupbut does not accept an argument-S,--suffix <SUFFIX>β override the usual backup suffix--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>]β control clone/CoW copies. See below
Possible values:
autoalwaysnever
--attributes-onlyβ Don't copy the file data, just the attributes. the aura, not the body β¨--preserve[=<ATTR_LIST>...]β Preserve the specified attributes (default: mode, ownership (unix only), timestamps), if possible 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 full source file name under DIRECTORY-P,--no-dereferenceβ never follow symbolic links in SOURCE-L,--dereferenceβ always follow symbolic links in SOURCE-Hβ follow command-line symbolic links in SOURCE-a,--archiveβ Same as-dR --preserve=all-dβ same as--no-dereference --preserve=links-x,--one-file-systemβ stay on this file system. no wandering off π§--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. π (we still love her)--copy-contentsβ NotImplemented: copy contents of special files when recursive-h,--helpβ Print help-V,--versionβ Print version<paths>
π EXTRA π
Do not copy a non-directory that has an existing destination with the same or newer modification timestamp; instead, silently skip the file without failing. 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; this avoids duplicate work if several cp -pu commands are executed with the same source and destination. 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. which gives more control over which existing files in the destination are replaced, and its value can be one of the following:
- 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:
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.12.0
π§ EXAMPLES π§
Copy a file to another location:
cp path/to/source_file path/to/target_file
Copy a file into another directory, keeping the filename:
cp path/to/source_file path/to/target_parent_directory
Recursively copy a directory's contents to another location (if the destination exists, the directory is copied inside it):
cp [-r|--recursive] path/to/source_directory path/to/target_directory
Copy a directory recursively, in verbose mode (shows files as they are copied):
cp [-vr|--verbose --recursive] path/to/source_directory
path/to/target_directory
Copy multiple files at once to a directory:
cp [-t|--target-directory] path/to/destination_directory path/to/file1
path/to/file2 ...
Copy all files with a specific extension to another location, in interactive mode (prompts user before overwriting):
cp [-i|--interactive] *.ext path/to/target_directory
Follow symbolic links before copying:
cp [-L|--dereference] link path/to/target_directory
Use the full path of source files, creating any missing intermediate directories when copying:
cp --parents source/path/to/file path/to/target_file
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. π«Ά
ok that's the whole page bestie, every last flag accounted for, no cap π―
and that's a wrap!! π this was v(uutils coreutils) 0.12.0, dated 2026-09-25, and yeah β that's CP(1) fr fr. mwah π
β¨
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms