Sys Admin go crazy when they are unable to run some commands. Recently I found that people have been facing lots of issues while copying huge files over to a remote server via “scp” command. This mainly happens when the connections gets closed and the scp command does not restart itself once the connection is established again with the remote server. SCP also fails to transfer file when there are limits set on server for transfers at various levels.
To over come this issue, we could use rsync command. It resumes the download process unlike scp.
Here is how rsync command looks :
rsync --partial --progress --rsh=ssh --archive
if you don’t want to recall all the options mentioned above and would like to continue using a command which is just like scp, continue reading.
I just created an alias called rscp (resumable scp) with the options mentioned above.
alias rscp="rsync --partial --progress --rsh=ssh --archive"
You can execute the above line in the console before using the rscp command to transfer the files. Or you can even put this inside .profile or .bashrc file of your home directory. (Do ensure that you open a new shell before you use the command if you’re adding the alias line in .bashrc or .profile as these files will be read when a new shell is opened)
Now its time to use your alias :
rscp
The transfer will not break like earlier. Let me know if you still continue facing error with this.