rsync is a popular tool for synchronization files between two computer systems. It is a valuable utility for syncing files locally and remotely. This file transfer and synchronization tool are often seen in Linux or Unix-based systems. For saving network bandwidth, rsync employs a type of delta encoding. This delta encoding enables rsync to send only the differences between the destination and the source files.

Here is the basic syntax of the rsync command:

$ rsync options Source Destination

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.

rsync –progress:

For demonstrating a practical example, we have created two test directories, “testdir1” and “testdir2”. “testdir1” contains the following content:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-1.png" data-lazy- height="455" src="data:image/svg xml,” width=”715″>

Now, we will sync the “testdir1” directory and its files to the “testdir2”.

$ rsync -av testdir1/ 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.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-2.png" data-lazy- height="542" src="data:image/svg xml,” width=”669″>

–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:

100000  75%  220.64kB/s  0:00:03

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:

1260000  100%  246.38kB/s    0:00:06  (xfer#7, to-check=200/396)

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.

$ rsync -av –progress testdir1/ testdir2/

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-3.png" data-lazy- height="536" src="data:image/svg xml,” width=”714″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-4.png" data-lazy- height="545" src="data:image/svg xml,” width=”716″>

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.

$ rsync -av –progress –stats testdir1/ testdir2/

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-5.png" data-lazy- height="543" src="data:image/svg xml,” width=”715″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-6.png" data-lazy- height="543" src="data:image/svg xml,” width=”714″>

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
  • ETA

Write out the below-given command for installing “pv” on your system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-7.png" data-lazy- height="344" src="data:image/svg xml,” width=”709″>

Here is the syntax of the pv command that is used for monitoring the file transfer

$ rsync options source dest | pv -lpes Number-Of-Files


$ rsync -vrltD testdir1/ testdir2/ | pv -lep -s 5

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-8.png" data-lazy- height="542" src="data:image/svg xml,” width=”786″>

You can also utilize the following command for the same purpose.

$ rsync -vrltD –stats –human-readable testdir1/ testdir2/ | pv -lep -s 5

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/How-to-see-rsync-progress-9.png" data-lazy- height="539" src="data:image/svg xml,” width=”782″>

Conclusion:

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.

About the author

<img alt="" data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/talha.jpg60cd15606e743.jpg" height="112" src="data:image/svg xml,” width=”112″>

Talha Saif Malik

Talha is a contributor at Linux Hint with a vision to bring value and do useful things for the world. He loves to read, write and speak about Linux, Data, Computers and Technology.