- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to resume a partially transferred file over ssh on Linux?
There is always a scenario where we sometimes encounter the transfer of files to be broken because of some reason. The reasons could be different, unless it is not that you explicitly closed the particular connection or process, it can be recovered.
It should also be noted that the scp command doesn’t have a resume option, and the only option is to simply start copying the files from the beginning and overwrite the existing files. The process of doing this again and again because of the ssh disconnection can be very annoying and time consuming.
Linux does provide us with a command utility that we can make use of instead of the ssh and the utility is named as Rsync.
With the help of the Rsync command utility we can easily resume the process of the files that were partially transferred over SSH.
In order to make use of Rsync, we must first understand what it is and what are the benefits of using it.
Rsync is a Linux command line utility that is used to transfer and copy files or folders to and from local to remote systems. It offers a large number of options that we can make use of, and it is very flexible to use as well. It is famous for its delta-transfer algorithm, which helps in reducing the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination.
Rsync mainly finds its use for backups and mirroring and is basically an improved version of the copy command.
Now, before making use of the Rsync utility we should Install it first. Several commands are mentioned below that explain how to install the Rsync utility on your machine.
For Debian, Ubuntu
sudo apt-get install rsync
On Fedora
sudo dnf install rsync
Now let’s see an example where I will try to copy a particular file from my machine to some other remote machine.
Command
scp goAgent.tar.gz immukul@192.168.110.11:/home/Documents/
In the above case, I am making use of the scp command, which is short for secure copy, that allows us to copy files from local to remote and vice versa.
I will deliberately cancel the above process with the help of the CTRL + C
Output
Now if I check the file in the remote machine, this is what I will see −
goAgent.tar.gz 51% 399MB 26.2MB/s 00:39 ETA^c
Now just run the Rsync command like this and your process will resume.
rsync -P -rsh=ssh goAgent.tar.gz immukul@192.168.110.11:/home/Documents/
Output
goAgent.tar.gz 100% 840.00M 26.2MB/s 0:00:43
- Related Articles
- How to use Python modules over Paramiko (SSH)?
- How to perform different commands over ssh with Python?
- How to grep and replace a word in a file on Linux?
- How to encrypt and decrypt a file using gpg command on linux
- How to find the most recent file in a directory on Linux?
- How to quickly sum all the numbers in a file on Linux?
- How to suppress a binary file matching results in grep on Linux?
- How to prevent a background process from being stopped after closing SSH client in Linux?
- How to copy a file to a remote server in Python using SCP or SSH?
- Getting root permissions on a file inside of vi on Linux
- What does opening a file actually do on Linux?
- How to get only the file name using find command on Linux?
- How to replace spaces in file names using bash script on Linux?
- How to sort a file in-place in Linux?
- How to Save Command Output to a File in Linux?
