Transferring Files

The scp and rsync commands can copy files to and from a remote server. The scp command, short for “secure copy,” works almost like the SSH command. You’ll look at that one first.

Copying Files with scp

You can copy the data.json file you created previously from the server to your local machine using the scp command.

Specify the source path first, followed by the destination path. The source is on the remote server, so you’d specify the username and server address, followed by the path to the file on the server, using a colon to separate the host from the remote path:

 (local)$ ​​scp​​ ​​brian@192.168.99.100:~/data.json​​ ​​data.json
 data.json 100% 162 172.7KB/s 00:00

To transfer the file back, reverse the source and destination ...

Get Small, Sharp Software Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.