cp fromfile tofile cp fromfile... todir cp -r fromdir... todir
In the second form the commands copy one or more fromfiles into a todir under their original file names, as if by a sequence of commands in the first form. Thus
cp f1 f2 diris equivalent to
cp f1 dir/f1; cp f2 dir/f2When the cp command copies the contents of plain (non-directory) files fromfile to tofile, the mode and owner of tofile are preserved if it already exists; the mode of fromfile is used otherwise.
-r
|
The -r option directs cp to recursively copy the named directories (fromdir's) to the target direction (todir), the last entry on the command line.
|
Diagnostics
The cp command refuses to copy files onto themselves.