cp <src> <dest>Copies a file. Overwrites the destination without asking.
Example
cp config.yml config.yml.bakCopies files and directories, preserving attributes when asked.
sudo apt install coreutilscp <src> <dest>Copies a file. Overwrites the destination without asking.
Example
cp config.yml config.yml.bakcp <file1> <file2> <dir>/Copies several files into a directory.
Example
cp a.txt b.txt backup/cp -r <dir> <dest>Copies a directory recursively.
Example
cp -r project project-copycp -i <src> <dest>Asks before overwriting.
cp -n <src> <dest>Never overwrites existing files.
cp -v <src> <dest>Prints each file as it is copied.
cp -p <src> <dest>Keeps mode, ownership and timestamps.
Example
cp -p evidence.log /cases/cp -a <src> <dest>Archive mode: recursive, preserves everything including symlinks. Best for backups.
Example
cp -a /etc /backup/etccp -u <src> <dest>Copies only when the source is newer or the destination is missing.
Example
cp -u *.html /var/www/cp --backup=numbered <src> <dest>Keeps numbered backups of anything it overwrites (GNU).
Example
cp --backup=numbered app.conf /etc/app/