print friendly version

Questions and answers

228
How do I copy a file from a colleague's directory on the Unix system?


The commands described below need to be entered while logged in to the Unix server.   Normally you'll see a prompt ending with $ when the command interpreter (or shell) is ready for another command.

Your colleague should first make sure that their file can be accessed by other people, by giving the command

chmod   a+r   filename

in their account.

Then (in your account) you should issue the command

cp    ~theirusername/filename    .

(Note the full-stop (period) after a space at the end of this last command)
For example, suppose the other person's username is ano23 and the file was called project.pdf, the command would be

cp   ~ano23/project.pdf    .

 

The various parts of this command are explained as follows:

~ano23    (a tilde symbol followed by ano23) means "ano23's home directory";

/project.pdf   means "the file project.pdf within the ano23 home directory"

.  (a dot or period) means "the directory I'm in now", that is the destination directory for the copied file.

Help us to improve this answer

Please suggest an improvement
(login needed, link opens in new window)

Your views are welcome and will help other readers of this page.

Categories

This is question number 228, which appears in the following categories:

Created by Andy Clews on 27 July 2001 and last updated by Andy Clews on 4 August 2015