next up previous contents
Next: Renaming Files (mv) Up: ``Elementary'' Commands Previous: Listing Files (ls)

Copying Files (cp)

 

The name of the command used to copy files is cp. It can either create a copy of the contents of the first file with the second name given, or it can copy the contents of a whole bunch of files to a directory and give them the same name they originally had.

For example, copying file1 to file2:

 cp file1 file2
We will end up with two files with identical contents, one called file1 and the other called file2. If file2 existed prior to running the above command, we may overwrite the contents of file2, or the shell might give us an error saying that file2 existedgif.

An example of copying a bunch of files to a directory is:

 cp file1 file2 file3 directory1
After the command has been run, we will have the following directory:
 file1              file2              file3
 directory1/file1   directory1/file2   directory1/file3


next up previous contents
Next: Renaming Files (mv) Up: ``Elementary'' Commands Previous: Listing Files (ls)

Gordon Haverland
Sat Oct 9 13:50:48 MDT 1999