I'm trying to copy data from a remote server (university) to my local machine via scp

I know the basic command

username1@source_host:directory1/filename1 username2@destination_host:directory2/filename2

But I don't know how to specify (i.e find) the path I need for my local machine... How can I find that?

2 Answers 2


If you want to scp file to your local machine, you don't need to specify path for the destination_host you have in your command.

Simply do

scp username1@source_host:directory1/filename1 /path/on/your/local/machine/

where /path/on/your/local/machine/ is actually on your local machine, for instance /home/user/Documents/.

See scp man for reference, or this tutorial.


Once you logged onto the remote server you can query how you got there, to use the information for scp.

scp filename localuser@$(echo $SSH_CONNECTION|awk '{print $1}'):Downloads

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .