Welcome guest


cp - Copy

It is important to be able to copy and move files around on the file tree. You only have access to write (or edit) files that are located in your account space. As a result, anything that you wish to work with has to be in your home directory. Copying a file allows you to do that. When you copy a file the original file still exists and a copy is placed where you tell the computer to put it (the destination path name).

Syntax

eos% cp source_path destination_path

Example 1

How would you copy the file INLAB2 to your home directory if you were in the lab-2directory?

Ask yourself:

Q: What am I doing? A: Copying a file.
Q: How do I do that? A: Using the cp.
Q: What are the path names? A: I am in the lab-2. It is in lab-2 and it is going to my home directory.

cp in the File Tree

Example 2

How would you copy the file INLAB2 to your home directory if you were in your home directory?

Ask yourself:

Q: What am I doing? A: Copying a file.
Q: How do I do that? A: Using the cp command.
Q: What are the path names? A: I am in my home directory. It is in lab-2 and it is going to my home directory.

cp in the File Tree 2

Example 3

How would you copy the file INLAB2 to your home directory if you were in your home directory?

Ask yourself:

Q: What am I doing? A: Copying a file.
Q: How do I do that? A: Using the cp command.
Q: What are the path names? A: I am in my home directory. It is in lab-2 and it is going to my home directory.

cp in the File Tree 3