Marc Blase

Sorry ‘cp’ I’m gonna be spending more time with ‘rsync’ now

So just updated my dev machine and was transferring files back to it via cp which was taking a long time. I just wanted to know how far along the command had progressed via a percentage/progress bar/etc. so that I could get a cup of coffee, or make lunch – if it was gonna take a very long time. I know it’s possible to do this but not by using cp alone.

So I found rsync after a little bit of googling. The part that I really like about it is the --progress option, which let’s you know via stdout how far along the command is.

Here is a basic example:

rsync --progress -a /path/to/source /path/to/destination

– This will copy a directory, show progress, and maintain ownership, permissions, modified via the -a option (Archive).

or, over the network:

rsync -zP /path/to/source handle@domain.tld:/path/to/destination

– This will copy source over the network connection specified, use compression, show progress and allow for continuing interrupted transfers.

P.S. As a preemptive measure you could also run du -sh on dirs before copying to get an idea of how big they actually are.

Published on December 3, 2013