How to copy a file ...
Clear all

How to copy a file from a remote server to a local Linux machine?

Member Admin
Joined: 2 years ago
Posts: 31
Topic starter  

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?

Topic Tags
Member Moderator
Joined: 2 years ago
Posts: 52

The syntax for scp is:

If you are on the computer from which you want to send file to a remote computer:

scp /file/to/send username@remote:/where/to/put

Here the remote can be an FQDN or an IP address.

On the other hand, if you are on the computer wanting to receive file from a remote computer:

scp username@remote:/file/to/send /where/to/put

scp can also send files between two remote hosts:

scp username@remote_1:/file/to/send username@remote_2:/where/to/put

So the basic syntax is:

scp username@source:/location/to/file username@destination:/where/to/put

You can read the manual of scp command for more details, view manual using below command

man scp


This post was modified 1 year ago by myTechMint