up vote 0 down vote favorite
share [g+] share [fb]

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.

link|improve this question
feedback

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

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

2 Answers

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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