Here is the basic syntax of the rsync command:
When you use rsync to copy or sync a file, it usually does not offer a progress bar or any other indication of the data’s size and speed. Sometimes, you may want to check the status of a massive file transfer and the progress of the data transferred from time to time. This brief post will teach you how to check the rsync file progress and view the file transfer statistics.
For demonstrating a practical example, we have created two test directories, “testdir1” and “testdir2”. “testdir1” contains the following content:
Now, we will sync the “testdir1” directory and its files to the “testdir2”.
Recursive syncing is done with the “-a” option and verbose output with the “-v” option. For example, the below-given output displays the verbose of the file synchronization between testdir1 and testdir2, but it did not show the progress of the rsync file transfer.
“–progress” or the “–P” force rsync to print out the information related to the file transfer. This provides a bored user something to see while the huge file transfers finish. While the rsync command transfers a file, –progress updates the progress like this:
The above progress statistics tell us that the destination has reconstructed 100000 bytes or 75% of the source file at the rate of 220.64kb/s. Therefore, if the present rate is maintained until the completion of the procedure, the file transfer will complete in 3 seconds. However, these numbers can be misleading. For example, if the source file contains the essential files followed by extra data, the transfer rate will drop substantially. In such a case, the file transfer will take much longer to complete than the expected time.
At the file transfer completion, rsync replaces the progress with a summary bar that looks like:
In the above example, in total, the file was 1260000 bytes, 246.38kB/s is the average rate of throughout file transfer, and it took 6 seconds to complete. The progress bar in the output also states that during the current rsync session, it was the 7th regular file transfer, and there are 200 more files for the destination to check.
Method 1: Using –progress option to see the rsync progress:
Use the “–progress” in the rsync command and “-av” to get a summary at the end of file transfer, consisting of transfer rate, sent/receive bytes, speed of transfer, and total file size.
Viewing statistics of the rsync:
To get more details about the file synchronization process and its progress, utilize the “–stats” option with the “–progress” option in the rsync command.
Method 2: Viewing the progress of rsync using pv command:
You can use the pv command to track the progress of the data transfer through a pipeline. It contains the following information:
- Current throughput rate
- Time elapsed
- Total data transferred
- Percentage completed with its progress bar
Write out the below-given command for installing “pv” on your system.
Here is the syntax of the pv command that is used for monitoring the file transfer
$ rsync -vrltD testdir1/ testdir2/ | pv -lep -s 5
You can also utilize the following command for the same purpose.
In Linux-based systems, rsync exists as a free software utility. It is used to sync or transfer directories and files from remote to the local system, local to a remote system, or the same system. Sometimes, you may want to check the status of a massive file transfer and the rsync progress of the data transferred from time to time. In this article, you have learned two different methods of seeing rsync file transfer progress.