-v
- verbose-h
-human readable
or help when human readable doesn't apply--help
- help
Single SOURCE:
cp [OPTION]... [-T] SOURCE DEST
-T, --no-target-directory
- Treat DEST as a normal file
Multiple SOURCEs:
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
-t, --target-directory=DIRECTORY
- All SOURCE arguments into DIRECTORY
-i
- interactive-b, --backup=[CONTROL] | -S/--suffix=[~]
- backup--strip-trailing-slashes
- remove any trailing slashes from each SOURCE argument; useful in scripts.
Conflict resolution:
-n
- no clobber-f
- force clobber [remove dest first]-u
- update only when source is newer
Common cases:
cp -a
- Preserve security context, xattrs, etc - Also impliesdR
- no-deference linkscp -R/-r
- Recursive (R
is only for parity withls -R
wherer
is reverse sort)cp --parents ./<src> <dest>/
- To copy current [dot-prefixed] dir tree into destcp --parents <src> <dest>
- To copy absolute path from root tree into destcp -R src/. dest
- Copy all the contents of the src into dest. Note thedot
aftersrc
Useful options:
-L
- override no-deference to always follow sym links-x
- stay inside one fs-s
- sym link instead of copy
Default preserves: timestamp, mode, owner