Example:
Examples
Copy one single local file to a remote destination
scp /path/to/source-file user@host:/path/to/destination-folder/
So, if you wan to copy the file
/home/user/table.csv
to a remote host named host.example.com
and copy there to jane's home folder, use this command.scp /home/user/table.csv jane@host.example.com:/home/jane/
Copy one single file from a remote server to your current local server
scp user@host:/path/to/source-file /path/to/destination-folder
Let's say now you want to copy the same file from jane's home folder in
host.example.com
to your local home folder.scp jane@host.example.com:/home/jane/table.csv /home/user/
Copy one single file from a remote server to another remote server
With
scp
you can copy files between remote servers from a third server without the need to ssh into any of them, all weight lifting will be done by scp
itself.scp user1@server1:/path/to/file user2@server2:/path/to/folder/
Let's say now you want to copy the same table file from jane's home folder to pete's home folder in another remote machine.
scp jane@host.example.com:/home/jane/table.csv pete@host2.example.com:/home/pete/
Copy one single file from a remote host to the same remote host in another location
scp jane@host.example.com:/home/jane/table.csv pete@host.example.com:/home/pete/
This time, you will be copying from one host to the same host, but on different folders under the control of different users.
Comments
Post a Comment