Latest news from 5wire Networks

What is rsync and how to use it?

Data synchronisation is a crucial aspect of managing files and folders across different systems or locations. Among the myriad of tools available for this purpose, rsync stands out for its efficiency, flexibility, and robustness. In this tutorial, we’ll delve into the fundamentals of rsync and explore how to use it effectively for synchronizing data between local and remote systems.

What is rsync?

rsync is a powerful command-line utility for efficiently transferring and synchronizing files and directories between different systems. It’s designed to minimize data transfer by only copying the parts of files that have changed, which makes it ideal for syncing large volumes of data over networks.


  • Linux/Unix: rsync is typically pre-installed on most Linux and Unix distributions. If not, you can install it using your distribution’s package manager (e.g., apt for Ubuntu, yum for CentOS).
  • macOS: rsync is included with macOS by default.
  • Windows: For Windows users, rsync can be installed using third-party packages such as Cygwin, or by using the Windows Subsystem for Linux (WSL)

Basic Usage

The basic syntax of rsync is as follows:

rsync [options] source destination
  • source: Specifies the source directory or file you want to synchronize.
  • destination: Specifies the target directory where you want to synchronize the data.


rsync -avz /path/to/source/ user@remote_host:/path/to/destination/

Key Options

  • -a, –archive: Archive mode, which preserves permissions, ownership, timestamps, and recursive copying.
  • -v, –verbose: Verbose output, providing detailed information about the sync process.
  • -z, –compress: Enables compression during data transfer, reducing bandwidth usage.
  • -n, –dry-run: Performs a trial run without making any changes, useful for previewing sync operations.
  • –delete: Deletes extraneous files from the destination directory. Use with caution.

Advanced Usage

  • Remote Synchronization: rsync can synchronize files between local and remote systems using SSH:
rsync -avz -e ssh /path/to/source/ user@remote_host:/path/to/destination/
Exclude Files: You can exclude specific files or directories from synchronization using the --exclude option:
rsync -avz --exclude='*.log' /path/to/source/ user@remote_host:/path/to/destination/
Include/Exclude Patterns: rsync allows using include and exclude patterns for finer control over synchronization:
rsync -avz --include='*.txt' --exclude='*' /path/to/source/ user@remote_host:/path/to/destination/


rsync is a versatile tool for synchronising data efficiently across local and remote systems. By mastering its usage and understanding its various options, you can streamline your data management tasks and ensure that your files are always up-to-date across different environments. Experiment with different options and combinations to tailor rsync to your specific synchronization needs.


Life time discount when you purchase your first order. Applies to Web Hosting, Reseller Hosting, and Cloud Servers.

Free Domain included on yearly Web Hosting plans.

Use code WEBOFF at the checkout!

Terms and Conditions apply. Voucher code is only valid for new customers.