How to copy a file from remote server to local machine? [closed]

Posted on Feb 19, 2023

Question

In my terminal shell, I ssh'ed into a remote server, and I cd to the directory I want. Now in this directory, there is a file called table that I want to copy to my local machine /home/me/Desktop. How can I do this?

I tried scp table /home/me/Desktop but it gave an error about no such file or directory. Does anyone know how to do this?

Thanks

Answer

For example, your remote host is example.com and remote login name is user1:

scp user1@example.com:/path/to/file /path/to/store/file