Copy (cp)
Use: Use the copy (cp) command to copy any files that you wish to work with into another directory.
In the NFS 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. Thus, you must copy files 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 lets you 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 ~/
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: /mnt/coe/workspace/csc/admin/e115
eos$ cp /mnt/coe/workspace/csc/admin/e115/common/lab-3/inlab3.txt ~/
OR
eos$ cp /mnt/coe/workspace/csc/admin/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.
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 ~/
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.