Copying Local to Remote
Jun 2, 2022
Need to transfer a directory with a lot of small files to a remote server? I found that taring the contents locally, then untaring them on the remote server can drastically increase the upload speed (in my case it was by a factor of 4 compared to using scp). Here’s a nice one line bash command you can use:
tar cz local_directory | pv | ssh user@remote_server ‘cat | tar xz -C /path/to/remote/directory/’
You can take out the pv function if you want; it’s just there to track upload progress.