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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.