Examples:
cp -r a b
Copy the entire contents of directory a into directory b.
cp a.txt backup
Copy the file a.txt across to the directory backup.
cp a.txt backup/a_bk.txt
Copy the file a.txt across to the directory backup and rename it a_bk.txt at the same time. If the file backup/a_bk.txt already existed then it will be overwritten without warning.
cp -i a.txt backup/a_bk.txt
The same as above but asks for confirmation before overwriting an existing file.
cp a b c d
In the above form, every parameter but the last - are the files to copy, and the last parameter - is the directory to copy the files too.
|