The cp command lets you copy a file from one location to another on a UNIX machine.
The cp command produces no output unless you have made a mistake.
The cp command will overwrite an existing file without warning you.
Most UNIX commands have a variety of additional command modifiers that can be used to change the output. For example, if you typed
cp -r * /tmp
you would copy everything in the directory and RECURSIVELY (-r) everything in the subdirectories underneath that directory to the /tmp directory.
Other popular cp commands include
|
What to Type |
What it Does |
|
|
copy file1 to a file called file2 |
|
|
copy file1 to the /tmp directory |
|
|
copy file1 to the home directory of "smith" |
|
|
copy everything in the directory to the /tmp directory |
For more help with the cp command or to see the online UNIX manual for the cp command, click here.
The mv command is similar to the cp command, except it copies the file and deletes the original.
The mv command is what you would use to rename a file
Other popular mv commands include
|
What to Type |
What it Does |
|
|
rename file1 to the name file2 |
|
|
move file1 to the /tmp directory |
|
|
move file1 to the home directory of "smith" |
|
|
move everything in the directory to the /tmp directory |
|
|
move the directory called dir2, |
For more help with the mv command or to see the online UNIX manual for the mv command, click here.