Linux Commands

How to Measure and Show the Progress of a rsync copy Linux?

Rsync stands for “remote sync”, which is a free and open-source command-line file synchronization utility used for transferring files and directories to local and remote destinations. It is an efficient utility as it only copies the changes from the source. Hence, it minimizes the amount of data copied to the remote destination. It is used for data backups, mirroring, and transferring data from one location to another.

Normally when you a copy file using rsync, it does not show any progress bar or the measure of speed or size of data transferred. During large file transfers, you may sometimes want to view the progress of the transfer and the size of the data transferred.

In this quick tip, we are going to show how to measure and show the progress of rsync when copying the files in Linux. We will also show you how to view the statistics of the file transfer.

This is the syntax of the basic rsync command:

$ rsync options SOURCE DESTINATION

For instance, to copy a directory named sample and its contents to the Downloads directory, the command would be:

$ rsync -av sample/ Downloads/

Where a option is used for recursive syncing and v is used for verbose output.

This is the output of the above rsync command that shows the verbose output of the file transfer process. However, as you can see, it is not showing any progress or statistics of the file transfer.

Show Progress of Rsync Copy

In order to show the progress of the Rsync copy process, use the rsync built-in–progress option.

Here is the syntax of the command:

$ rsync --progress SOURCE DESTINATION

For instance, to view progress while copying a directory named sample and its contents to the Downloads directory, the command would be:

$ rsync -av --progress sample/ Downloads/

Where –progress is used to show the progress bar of transfers, a option for recursive syncing, and v for displaying a verbose output.

This is the output of the above rsync command that shows the progress of each file copying to another location. At the end of the file transfer, you will see a summary line showing sent/receive bytes, rate of transfer, total size, and speed of transfer.

In the above output, you can see the average rate of transfer is 78,078,648.67 bytes/sec, the total file size is 169,746,317 bytes, and it took 1.45 seconds to complete the transfer.

Show Statistics of Rsync Copy

There is another option –stats that some more statistics about the file transfer like Number of files and Number of files transferred, total file size and total transferred file size, etc. To include these statistics in your output along with file transfer progress, you can use the –stats option with rsync as follows:

$ rsync –progress –stats SOURCE DESTINATION

For instance, to view progress and the statistics while copying a directory named sample and its contents to the Downloads directory, the command would be:

$ rsync -av --progress --stats sample/ Downloads/

Where –progress is used to show the progress bar of transfers, –stats for displaying statistics, a option for recursive syncing, and v to display a verbose output.

This is the output of the above rsync command that shows the progress of each file copying to another location. At the end of the file transfer, you will see file transfer statistics and a summary line showing sent/receive bytes, rate of transfer, total size, and speed of transfer.

In this post, you have learned how to measure and show the progress of rsync copying the files from source to destination. The –progress option shows the progress of the transfer while the –stats options show the statistics of the file transfer. These options give a boring user something to watch while they transfer large files.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.