summaryrefslogtreecommitdiff
path: root/Base/usr/share/man/man1/cp.md
blob: 812c1f0f31f405e78c730206b33f996c2f98f77c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Name

cp - copy files

## Synopsis

```**sh
$ cp [options...] <source...> <destination>
```

## Description

`cp` copies files specified in `source` to `destination`.

If there are several `sources`, the directory `destination` is created and all files specified in `sources` are copied into that directory. Otherwise, the `source` file is copied as `destination` file. If the file exists, it is overridden. If `destination` directory exists and there is only one `source`, the `source` file is copied into the `destination` directory.

If a directory is specified in `source`, the `-R` (recursive) flag is required. Otherwise, an error occurs.

## Options

* `-l`, `--link`: Create hard links instead of copying
* `-R`, `-r`, `--recursive`: Copy directories recursively
* `-v`, `--verbose`: Display what files are copied

## Examples

```sh
# Copy cpp-tests file and name it cpp-tests-backup
$ cp cpp-tests cpp-tests-backup

# Copy cpp-tests directory and name it cpp-tests-backup
$ cp -R cpp-tests cpp-tests-backup

# Copy cpp-tests file into existing root
$ cp cpp-tests root
```