Show File Transfer Progress With Rsync Command in Ubuntu
Keep a tab on the transfer progress helps a lot. Learn how to see transfer progress stats for individual files as well as overall files.
The rsync command is a blessing for those who manage multiple systems or servers, as it is the most convenient way to send files between networks.
But when you use rsync to transfer large files, having a progress bar can help a lot! And to get the progress bar, you use the --progress
option:
rsync --progress [other options] [source] [destination]
So in this guide, I will show you how you can enable the file transfer progress bar for the following cases:
- Progress bar for individual files
- Progress bar for the overall file transfer
Show the progress bar for individual files in rsync
While moving the entire directory, you may want to monitor the transfer of each file. And for that purpose, you'd have to use the --progress
option:
rsync --progress -avz /home/user/docs/ example.com:/backup/docs/
Here,
-a
(archive): used to preserve timestamps, file permissions, ownership, and other attributes.-v
(verbose): shows the info of what is being transferred.-z
(compression): it will reduce the file while transferring so you can reduce the time taken to transfer a large file.
Similarly, if you want to use the ssh connection, you'd have to add two more options to the above command:
rsync --progress -avz -e ssh file.txt [email protected]:/path/to/destination/
Here, the -e
option is used to specify the file is being transferred over the remote connection.
So let's say I want to transfer the ISO
directory to the remote server using ssh, then, I will have to use the following command:
rsync --progress -avz -e ssh ~/ISO [email protected]:~/MyFiles/
And as you can see, it shows the progress for the individual file.
Show the progress bar for overall file transfer in rsync
So if you want to monitor the overall transfer rather than checking the transfer for individual files, all you have to do is make a slight change in the above command.
To show the progress bar for the overall process, you'd have to use two options --info=progress2
and --info=name0
as shown:
rsync --info=progress2 --info=name0 -avz /home/user/docs/ example.com:/backup/docs/
Similarly, if you want to use ssh, the command would look like this:
rsync --info=progress2 --info=name0 -avz -e ssh file.txt [email protected]:/path/to/destination/
For example, if I want to transfer the entire directory named SSY
to my remote server and want the overall file transfer progress, then I will be using the following command:
rsync --info=progress2 --info=name0 -av -e ssh ~/SSY/ [email protected]:~/MyFiles/
Pretty cool. Isn't it?
Want to learn more about rsync? Here you go
The rsync is one of the most useful commands in Linux so if you are into servers, the rsync offers a lot more than what I explained above.
And if you want to learn how it can be used differently, here is a detailed guide covering how it can be useful in practical life:
I hope you will find this guide helpful. And if you have any suggestions, feel free to ask in the comments.
A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.