see rsync progress in linux

How to Show Progress in Rsync

Rsync is a popular tool used for synchronizing files & directories between two systems. You can use it to sync files & folders locally as well as remotely. It is a smart tool that calculates the difference between two files and copies only the difference instead of doing a full file transfer. This saves network bandwidth and improves speed. By default rsync doesn’t display any message during file transfer. Sometimes you may need to view the progress of your rsync command in case you are transferring large files & directories. In this article, we will learn how to show progress in Rsync.


How to Show Progress in Rsync

Here is the syntax of rsync command.

$ rsync options Source Destination

There are a couple of ways to view progress of rsync command.


1. Using -progress option

You can use -progress or -P to force rsync to display the progress information of file transfer. Here is a sample command.

$ rsync -progress testdir1/ testdir2/

You will see the following kind of output.

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

The above output says that 100000 bytes, that is, 75% of files have been reconstructed at the rate of 220.64kbps and the file transfer will complete in 3 seconds. But this is just an estimate. When file transfer completes, rsync will replace it with actual values.

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

As you can see, the actual transfer took 6 seconds. This is done for each file. xfer#7 indicates that it is the 7th file being transferred. to-check=200/396 indicates that there are 200 more files to be checked.

Here is a snapshot of the command output.

If you want to see more details, you can also use –stats option with rsync command.


2. Using pv command

You can also use pv command to view progress of a command. It displays the following information:

  • Current throughput rate
  • Time elapsed
  • Total data transferred
  • Percentage completed with its progress bar
  • ETA

Here is the command to install pv command in Linux.

$ sudo apt install pv

Once it is installed, you can use the pv command to view progress or rsync command.

$ rsync options source dest | pv -lpes Number-Of-Files
$ rsync -vrltD testdir1/ testdir2/ | pv -lep -s 5
$ rsync -vrltD --stats --human-readable testdir1/ testdir2/ | pv -lep -s 5

Basically, we pass the output of rsync command to pv command to display progress in easy to understand manner. Here is what your output will look like.

In this article, we have learnt how to show progress in rsync.

Also read:

How to Clean Up Snap Packages in Linux
How to Fix Unacceptable TLS Certificate Error in Linux
How to Reconfigure Installed Package in Ubuntu/Debian
Return False vs PreventDefault in JavaScript
How to Get Unique Values in JS Array

One thought on “How to Show Progress in Rsync

  1. if you want to see the only `pv` output rolling the progressbar add `-q` rsync option and perhaps 2>/dev/null before de pipe `|`

Leave a Reply

Your email address will not be published.