How can I view a progress bar when running rsync?

rsync has a --info option that can be used to not only output the current progress, but also the transfer rate and elapsed time:

--info=FLAGS            fine-grained informational verbosity

The explanation of how to use it comes under the -P option in the man page:

-P     The -P option is equivalent to --partial --progress.  Its purpose is to
       make it much easier to specify these two options for a long transfer that
       may be interrupted.

       There is also a --info=progress2 option that outputs statistics based on
       the whole transfer, rather than individual files.  Use this flag
       without  out‐putting  a  filename  (e.g. avoid -v or specify --info=name0)
       if you want to see how the transfer is doing without scrolling the screen 
       with  a  lot  of names.   (You  don’t  need  to specify the --progress
       option in order to use --info=progress2.)

So the following:

rsync -r --info=progress2 --info=name0 "$src" "$dst"

Results in the following being output and continuously updated:

18,757,542,664 100%   65.70MB/s    0:04:32 (xfr#1389, to-chk=0/1510)

Note that when the transfer starts the total number of chunks, and therefore the current progress, can change when the recursive option is used as more files are discovered for syncing


You can use --progress and --stats parameters.

rsync -avzh --progress --stats root@server:/path/to/file output_name

root@server's password: 
receiving incremental file list
file
         98.19M  54%    8.99MB/s    0:00:08

How about this?

rsync_param="-av"
rsync "$rsync_param" a/ b |\
     pv -lep -s $(rsync "$rsync_param"n a/ b | awk 'NF' | wc -l)
  • $rsync_param

    Avoids double input of parameters

  • $(rsync "$rsync_param"n a/ b | awk 'NF' | wc -l)

    Determines the number of steps to complete.

  • a/ b

    1. a/ is the source
    2. b is the target

Tags:

Rsync