Rsync is a powerful utility to backup and synchronizes your files and directories. You can see Rsync mainly used as a backup solution to snapshot your files and directories.
Rsync does an incremental backup, meaning it only captures what is newly modified (created, deleted, updated). There are many backup solutions like Timeshift, which uses rsync in the background to take backups. It is important that you know how to use rsync which will come in handy.
In this article, I will demonstrate different ways of displaying the progress bar while copying files using the rsync command. As always, either the man page or help command comes in handy to see what options are available for rsync.
$ man rsync $ rsync -h
Synchronizing Directories with Rsync
Let’s run the rsync command and see how the output is normally displayed. I have a set of images in the source directory and I am trying to sync with the different directories.
$ rsync -av /home/karthick/Pictures /home/karthick/Desktop/destination
Take a look at the above image. The output of the rsync command with
-v (verbose) displays the list of files to be synced and how much data (bytes) is sent and bytes/sec. This information is useful but there is no information about the progress of each file and directories.
Rsync Show Progress Bar While Copying Files
You can use the
--progress a flag which will show the progress of each object getting synced from source to destination. Now I am trying to sync a single virtual disk file which is 4GB.
When I try to initiate the command, you can see from the below output there is no information related to how much data is copied what is the rate at which data is getting copied.
$ rsync -avh Fedora\ 34disk002.vdi /home/karthick/Desktop/destination/
Now if I run the same command with the
--progress option progress related information is displayed.
$ rsync -avh --progress Fedora\ 34disk002.vdi /home/karthick/Desktop/destination/
When you try to sync a lot of files and directories then progress will be shown for all individual files and directories. If you just need the overall progress then use
--info=progress2 without using the
-v flag. The verbose flag will display information related to each object.
$ rsync -ah --info=progress2 <source> <destination>
How to Use Progress Command to Check Rsync Progress
Progress is another useful utility that shows progress when you run various commands like (cp, mv, dd, rsync, etc.). Run the following command to display the list of help options.
$ progress -h
Once the rsync command is initiated, run the following command which will track your rsync progress.
$ progress -m
Take a look at the below image. On the left side of my terminal, I initiated the rsync command and on the right side of my terminal, I ran the progress command which monitors the running process and shows the progress.
That’s it for this article. Rsync is very powerful and handy and if you have not tried the rsync command before I suggest start exploring it right away.