Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to use the following command:

$ scp remoteusername@host:$HOME/fileiwanttocopy /my/local/comp

I woould like for home to be evaluated on the remote host instead of my computer (which it is doing now) i've tried it with and without quotes.

share|improve this question

migrated from stackoverflow.com Sep 4 '09 at 4:54

This question came from our site for professional and enthusiast programmers.

2 Answers 2

To copy a file from the home directory on another machine, use:

scp remoteusername@host:fileiwanttocopy /my/local/comp

Note that the filename after ':' does not start with a '/', so it is relative from the home directory by default.

share|improve this answer

If you would like to copy a file from your home directory you could use either of the following:

$ scp remoteusername@host:fileiwanttocopy /my/local/comp
$ scp remoteusername@host:~/fileiwanttocopy /my/local/comp

The ~ will evaluate to the logged in user's home directory.
If you woul like to copy a file from another user's home directory you would use::

$ scp remoteusername@host:~anotheruser/fileiwanttocopy /my/local/comp

In which ~anotheruser would resolve to the user "anotheruser"'s home directory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.