# man > cp(1)

---
type: CommandReference
command: cp
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `cp {{path/to/source_file}} {{path/to/target_file}}` — Copy a file to another location.
- `cp {{path/to/source_file}} {{path/to/target_parent_directory}}` — Copy a file into another directory, keeping the filename.
- `cp -r {{path/to/source_directory}} {{path/to/target_directory}}` — Recursively copy a directory's contents to another location.
- `cp -vr {{path/to/source_directory}} {{path/to/target_directory}}` — Copy a directory recursively, in verbose mode.
- `cp -t {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}` — Copy multiple files at once to a directory.
- `cp -i *.ext {{path/to/target_directory}}` — Copy all files with a specific extension in interactive mode.
- `cp -L {{link}} {{path/to/target_directory}}` — Follow symbolic links before copying.
- `cp --parents {{source/path/to/file}} {{path/to/target_file}}` — Use full source path, creating missing intermediate directories.

## Name

cp - copy files and directories

## Synopsis

shell
cp [OPTION]... SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
## Options

### General

- `-a, --archive` — same as `-dR --preserve=all`
- `-d, --no-dereference --preserve=link` — preserve links and never follow symlinks
- `-f, --force` — remove existing destination file if cannot open; ignored with `-n`
- `-i, --interactive` — prompt before overwrite (overrides previous `-n`)
- `-n, --no-clobber` — do not overwrite existing files (overrides previous `-i`)
- `-u, --update` — copy only when source is newer or destination missing
- `-v, --verbose` — explain what is being done
- `-x, --one-file-system` — stay on this file system
- `--help` — display help and exit
- `--version` — output version information and exit

### Overwrite Control

- `--remove-destination` — remove each existing destination file before opening (contrast with `--force`)
- `--backup[=CONTROL]` — make a backup of each existing destination file
- `-b` — like `--backup` but does not accept argument
- `-S, --suffix` — override the usual backup suffix (default `~`)
- `-t, --target-directory` — copy all SOURCE arguments into DIRECTORY
- `-T, --no-target-directory` — treat DEST as a normal file

### Attributes

- `-p, --preserve` — preserve mode, ownership, timestamps (default)
- `--preserve=ATTR_LIST` — preserve specified attributes: `mode`, `ownership`, `timestamps`, `context`, `links`, `xattr`, `all`
- `--no-preserve=ATTR_LIST` — don't preserve specified attributes
- `--attributes-only` — copy only file attributes, not data
- `--context[=CTX]` — like `-Z`, or set SELinux/SMACK context to CTX

### Recursive and Links

- `-r, -R, --recursive` — copy directories recursively
- `-l, --link` — hard link files instead of copying
- `-s, --symbolic-link` — make symbolic links instead of copying
- `-L, --dereference` — always follow symbolic links in SOURCE
- `-P, --no-dereference` — never follow symbolic links in SOURCE
- `-H` — follow command-line symbolic links in SOURCE
- `--copy-contents` — copy contents of special files when recursive
- `--strip-trailing-slashes` — remove trailing slashes from each SOURCE argument

### Sparse / Reflink

- `--sparse=WHEN` — control creation of sparse files: `auto` (default heuristic), `always`, `never`
- `--reflink[=WHEN]` — control clone/CoW copies: `always` (fail if not possible), `auto` (fallback to standard copy), `never` (standard copy)

### Backup

- `--backup[=CONTROL]` — values: `none`/`off`, `numbered`/`t`, `existing`/`nil`, `simple`/`never`

## Examples

shell
cp {{path/to/source_file}} {{path/to/target_file}}
cp {{path/to/source_file}} {{path/to/target_parent_directory}}
cp -r {{path/to/source_directory}} {{path/to/target_directory}}
cp -vr {{path/to/source_directory}} {{path/to/target_directory}}
cp -t {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}
cp -i *.ext {{path/to/target_directory}}
cp -L {{link}} {{path/to/target_directory}}
cp --parents {{source/path/to/file}} {{path/to/target_file}}
## See Also

- [Full documentation from GNU coreutils](https://www.gnu.org/software/coreutils/cp)
- `info '(coreutils) cp invocation'` (available locally)