Show File Transfer Progress With Rsync
When you are transferring a large number of files that take some time, the rsync command shows a blank output.
The cursor just blinks without any information.
This leaves you wondering whether the files are being transferred or its just trying to connect to the remote server.
The good thing is that rsync is a versatile tool and it allows to show the status of file transfers.
Just add --progress
to your rsync command and it starts showing the files being transferred:
rsync -r --progress source destination
There is no specific location for the --progress
option. You can even add it to the end of the rsync command.
You also get to see a summary of files transferred along with the transfer speed and time.
-P
option instead of --progress
. It's the shorter form for the same.Show overall progress with rsync
This is all good. But if you have hundreds of files to transfer, it gets messy. The entire screen is filled with the file transfer statistics. You may not always want that.
Good thing again! You can make rsync show the overall progress instead of showing it for each individual file.
Instead of --progress
option, use info=progress2
option.
rsync -r --info=progress2 source destination
Here, you control the information to be displayed with the info
option. You tell it to show the information for the progress
i.e. file transfer.
Some flags, like progress, are followed by a number. 0 means to silence the output, 1 means to show it for each file and 2 means total transfer progress.
This way, you get to see the overall progress of the files being transferred with rsync. This is a much cleaner output. Your screen is not flooded and you can easily understand the output.
Once the rsync command finishes the file transfer, you also get to see the summary of average transfer speed and time spent.
That's super cool, isn't it? You now know how to display the file transfer progress with rsync command.
This is just one of the many cool things this handy CLI tool can do. Read this for more practical examples of the rsync command.