CP(1)

NAME
cp - Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

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.

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

-i, --interactive
    ask before overwriting files

-l, --link
    hard-link files instead of copying

-n, --no-clobber
    don't overwrite a file that already exists

-R, --recursive
    copy directories recursively

--strip-trailing-slashes
    remove any trailing slashes from each SOURCE argument

--debug
    explain how a file is copied. Implies -v

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

    •   none

    •   all

    •   older

    •   none-fail

-u  like --update but does not accept an argument

--reflink[=<WHEN>]
    control clone/CoW copies. See below Possible values:

    •   auto

    •   always

    •   never

--attributes-only
    Don't copy the file data, just the attributes

--preserve[=<ATTR_LIST>...]
    Preserve the specified attributes (default: mode, ownership (unix only), timestamps), if possible 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 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

--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
## 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](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md). > > Please note that, as uutils is a work in progress, some examples might fail.

VERSION
v(uutils coreutils) 0.9.0