1

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?

1

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.

1

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

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.