0

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.

5

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.

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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