One
of the uses of the cp
command is copying files (the next page discusses directories).
Command
Format
cp [-options]
source_file(s) destination
Examples
The following
is an example of how to create a new file by making a copy of
an existing file in the same directory:
$ ls
rerun
$ cp rerun marcy
$ ls
rerun marcy
$
Here is an
example of how to copy more than one file to a different directory:
$ pwd
/home/chuck
$ cp marcy marcy_6 /home/Snoopy
$ ls /home/Snoopy
marcy marcy_6
$
Use cp
-i so that you do not accidentally overwrite files. The
-i command will prompt you when you are about to overwrite
an existing file.
$ cp -i marcy
rerun
cp: overwrite rerun? n
$