Skip to main content
Kill -9 Club
Sign in

cp

FilesPackage: coreutils

Copies files. Without -a the copy loses owner, timestamps and symbolic links; fine for a working file, wrong for a configuration or a backup.

What its options do in the lessons

From the same glossary the lessons render under their commands, so the two cannot disagree.

cp -r
Copies directories and their contents.
cp -a
Archive: a recursive copy preserving owner, group, permissions, timestamps and symbolic links. This is what you want when moving service files, which a plain copy would re-own to you.
cp -i
Asks before overwriting an existing file. Without it, cp overwrites silently.
cp -n
Never overwrites: an existing file is left alone, with no question and no error.

Lessons that teach it