man.lsPlain-English help for Unix commands

cp Copy files and directories

Makes a copy of a file, or of several files, in another place. Add -R to copy whole folders. The original stays where it is.

Synopsis

cp [OPTION]... SOURCE TARGET
cp [OPTION]... SOURCE... DIRECTORY

Common options

Option or formWhat it does
-R, -rCopy a directory and everything inside it. Required for folders
-iInteractive: ask before overwriting an existing file
-nDo not overwrite an existing file
-fForce: replace existing files without asking
-pPreserve the modification time, permissions and, where allowed, owner of each file
-vVerbose: print each file as it is copied
-aArchive mode: copy a tree and keep attributes and symbolic links as they are (same as -RpP on macOS)

Examples

Copy a file under a new name
cp notes.txt notes-backup.txt
Copy several files into a folder
cp notes.txt app.log docs
Copy a whole folder
cp -R photos photos-backup
See what is copied and keep file dates
cp -pv data.csv data-copy.csv
Copy without overwriting anything
cp -n notes.txt docs/notes.txt
Ask before replacing a file
cp -i report.pdf /backup/report.pdf

Notes

See also

Last reviewed 2026-10-07.