How to See rsync Progress?

The rsync is the acronym for “Remote Sync,” which is the popular file-synchronizing tool in Linux. There are many synchronizing tools in Linux, but the feature popularity of rsync is it compares the files while transferring from the remote and local machine. In the comparison, it only copies the different files, restricting the duplication of the files. 

This post will address the possible methods to see the rsync progress in Linux:

How to Use the rsync Command in Linux?

The rsync command syncs the file and directories from the remote to the local machine and vice versa. The general syntax of using the rsync command:

$ rsync [options] [source] [destination]

The explanation of the above-mentioned general syntax:

  • Use the “rsync” to revoke the command.
  • Different “options” of the rsync command can be used.
  • Mention the “source” from where the files should be copied.
  • Mention the “destination” where the copied file will be transferred.

Different options can be used with the rsync command to explore them; the manual of the rsync can help. The manual of the rsync can be opened with the command:

$ man rsync

The manual will display the usage of the rsync command:

All the options have been explained with the help of examples. 

Method 1: See rsync Progress Using the progress Option

First method is convenient, using the “progress” option of the rsync command. For example, we will sync the test_dir1 to test_dir2 by displaying the progress:

$ rsync -av --progress test_dir1 test_dir2

In the output; we can see that the progress has been displayed. For example, we consider the progress of syncing the myfile1 of test_dir1 to the test_dir2:

24 100% 0.00kB/s 0:00:00

The output explains the the “24 bits” of the myfile1 are synced to “test_dir2” with the 0.00kB/s speed. The 100% file has been copied in 0 seconds. 

Note: The rate of transferring and time is approximately zero because of the small file. 

To display the detailed statistic of the rsync command, use the “–stats” option:

$ rsync -av --progress --stats test_dir1 test_dir4

We can see in the output more information on the progress has been displayed.

Method 2: See rsync Using the pv Command

The pv command in Linux monitors the data sent through the pipe. We can use the pv command piping with the rsync command to monitor the data and display its progress. The pv command displays the following information of the command with whom it is piped:

  • Elapsed time.
  • Completion percentage.
  • Throughput rate of transfer.
  • Total data transferred.
  • Total execution time.

Install pv Command:

The pv command can be installed on different Linux distributions, using the command:

$ sudo apt install pv                                #For Debian-based
$ sudo yum install pv                              #For RHEL-based
$ sudo pacman -S pv                               #For Arch-based

The options and the detailed usage of “pv” command can be seen as:

$ pv --help

Example:

Now, we will sync the test_dir1 to test_dir5 using the rsync and pv command:

$ rsync -av --progress --stats test_dir1 test_dir5 | pv -lep

The detailed progress information has been displayed. 

Conclusion

To see the rsync command progress, either use the rsync command with the “–progress” option or pipe the command with “pv -lep”. This blog has explained both these methods to display the progress of the rsync command when it is executed.