Copy (cp)

In the AFS system, you have editing (write) access to files located in your account space, but only read (no writing) access to files in the E115 Course Locker. Therefore, you must copy (cp) any files that you wish to work with into your home directory (or a sub-directory of your home directory) before attempting to edit it.    

eos$ cp source_path destination_path

The cp command also supports the ability to copy more than one file at a time while only using the command once:

eos$ cp source_path1 source_path2 source_path3 destination_path

If you need to copy an entire directory, you must use the -r option:

eos$ cp -r directory_path destination_path

Example 1: Copying a Single File in the E115 Course Locker

To copy inlab3.txt to your home directory, while you are in the lab-3 directory:

eos$ cp inlab3.txt ~/
Demonstrates the state of the file system before and after copying a single file to your home directory

Example 2: Copying a File in the E115 Course Locker, while in your Home Directory

To copy inlab3.txt from the /common/lab-3/ directory of the E115 Course Locker to your home directory, while you are in your home directory, simply append /common/lab-3/ to the end of the absolute pathname for the E115 Course Locker, along with the name of the file you want to copy. Don’t forget the destination pathname! Reminder that the pathname for the E115 Course Locker is: /afs/eos.ncsu.edu/lockers/admin/csc/e115

eos$ cp /afs/eos.ncsu.edu/lockers/admin/csc/e115/common/lab-3/inlab3.txt ~/

OR

eos$ cp /afs/eos.ncsu.edu/lockers/admin/csc/e115/common/lab-3/inlab3.txt ./

Note: since you are located in your home directory, the “./” (dot slash) represents your home directory, and you may use it instead of “~/” while in your home directory.

Demonstrates the state of the file system before and after copying a single file to your home directory from your home directory instead of being inside the course locker

Example 3: Copying Multiple Files

To copy inlab3.txt and info.txt from the lab-3 directory to your home directory while you are in the lab-3 directory:

eos$ cp ./inlab3.txt ./info.txt ~/
Demonstrates the state of the file system before and after copying multiple files to your home directory

Should I expect an output from the copy command?

No. A successful copy produces no output. If you are receiving output or an error message, you have either typed the directory path incorrectly, or the file does not exist in the specified location.