cp - copy files and directories
cp [-r] [-a] [-p] [-v] source... dest
Options you will use
-r, -R, --recursive- Copy directories recursively.
-a, --archive- Same as -dR --preserve=all: keep mode, ownership and timestamps.
-p- Preserve mode, ownership and timestamps.
-i- Prompt before overwriting.
-v, --verbose- Explain what is being done.
-a, --archive- Copy recursively and keep everything: modes, owners, times, links.
-l, --link- Make hard links instead of copying.
-L, --dereference- Follow symbolic links: copy what they point to.
Gotchas
- Trailing slashes matter:
cp -r a bwhere b exists puts a INSIDE b.
Taught in
Try cp in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.