Name
cp
Synopsis
cp [options
]file1 file2
cp [options
]files directory
Copy file1 to file2, or copy one or more files to the same names under directory. If the destination is an existing file, the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten).
Options
- -a, --archive
Preserve attributes of original files where possible. The same as -dpr.
- -b, --backup[=control]
Back up files to be overwritten. As -b, takes no argument. For --backup, control specifies the type of backup and can also be set with the environment variable VERSION-CONTROL. The default is existing. Valid arguments are:
- t, numbered
Always make numbered backups.
- nil, existing
Make numbered backups of files that already have them; otherwise, make simple backups.
- never, simple
Always make simple backups.
- none, off
Never make backups, even if --backup is specified.
- -c
The same as --preserve=context.
- --copy-contents
Copy contents of special files when recursive.
- -d
The same as --no-dereference --preserve=links.
- -f, --force
Remove an existing file in the destination if it can’t be opened. See also --remove-destination.
- -H
Follow command-line symbolic links in the source.
- -i, --interactive
Prompt before overwriting destination files. On most systems, this flag is turned off by default except for the root user, who is normally prompted before overwriting files.
- -l, --link
Make hard links, not copies, of nondirectories.
- -L, --dereference
Always follow symbolic links.
- --no-preserve ...
Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.