linux bash script that uses rsync to sync two servers

Presuming that you already have setup a rsync connection and permissions with ssh keys here is an useful piece of snippet that can help you synchronize folders faster. A real example where I use it is while I am migrating an old server to a new one where: files keep changing on the old server while the process from account managers and project managers takes time till they validate each web site or app that has been transferred successfully.

How to find directory size in linux

Here are some examples on how to find a directory size in linux:

du /var/www/vhosts/marianzburlea.com

This will show you the directory size of /var/www/vhosts/marianzburlea.com

du -h /var/www/vhosts/marianzburlea.com

This command gives you a better output than the default one. The option '-h' stands for human readable format. So the sizes of the files / directories are this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes.