Rsync Command in Linux with Examples

Rsync Command in Linux with Examples

rsync is a fast and versatile command-line utility for synchronizing files and directories between two locations over a remote shell, or from/to a remote Rsync daemon.

rsync is a fast and versatile command-line utility for synchronizing files and directories between two locations over a remote shell, or from/to a remote Rsync daemon. It provides fast incremental file transfer by transferring only the differences between the source and the destination.

Rsync can be used for mirroring data, incremental backups, copying files between systems, and as a replacement for [scp](https://linuxize.com/post/how-to-use-scp-command-to-securely-transfer-files/) , [sftp](https://linuxize.com/post/how-to-use-linux-sftp-command-to-transfer-files/) , and [cp](https://linuxize.com/post/cp-command-in-linux/) commands.

This article explains how to use rsync through practical examples and detailed explanations of the most common rsync options.

Installing Rsync

The rsync utility is pre-installed on most Linux distributions and macOS. If you don’t have rsync installed on your system, you can easily install it using your distribution’s package manager.

Install Rsync on Ubuntu and Debian

sudo apt install rsync

Install Rsync on CentOS and Fedora

sudo yum install rsync

Rsync Command Syntax

Before going into how to use the rsync command, let’s start by reviewing the basic syntax.

The rsync utility expressions take the following form:

Local to Local:  rsync [OPTION]... [SRC]... DEST
Local to Remote: rsync [OPTION]... [SRC]... [[email protected]]HOST:DEST
Remote to Local: rsync [OPTION]... [[email protected]]HOST:SRC... [DEST]
  • OPTION - The rsync options .
  • SRC - Source directory.
  • DEST - Destination directory.
  • USER - Remote username.
  • HOST - Remote hostname or IP Address.

rsync provides a number of options that control how the command behaves. The most widely used options are:

  • -a--archive, archive mode, equivalent to -rlptgoD. This option tells rsync to syncs directories recursively, transfer special and block devices, preserve symbolic links, modification times, groups, ownership, and permissions.
  • -z--compress. This option forces rsync to compresses the data as it is sent to the destination machine. Use this option only if the connection to the remote machine is slow.
  • -P, equivalent to --partial --progress. When this option is used, rsync shows a progress bar during the transfer and keeps the partially transferred files. It is useful when transferring large files over slow or unstable network connections.
  • --delete. When this option is used, rsync deletes extraneous files from the destination location. It is useful for mirroring.
  • -q--quiet. Use this option if you want to suppress non-error messages.
  • -e. This option allows you to choose a different remote shell. By default, rsync is configured to use ssh.

data science

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

What Are The Advantages and Disadvantages of Data Science?

Online Data Science Training in Noida at CETPA, best institute in India for Data Science Online Course and Certification. Call now at 9911417779 to avail 50% discount.

50 Data Science Jobs That Opened Just Last Week

Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments. Our latest survey report suggests that as the overall Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments, data scientists and AI practitioners should be aware of the skills and tools that the broader community is working on. A good grip in these skills will further help data science enthusiasts to get the best jobs that various industries in their data science functions are offering.

Data Science With Python Training | Python Data Science Course | Intellipaat

🔵 Intellipaat Data Science with Python course: https://intellipaat.com/python-for-data-science-training/In this Data Science With Python Training video, you...

Applications Of Data Science On 3D Imagery Data

The agenda of the talk included an introduction to 3D data, its applications and case studies, 3D data alignment and more.

Data Science Course in Dallas

Become a data analysis expert using the R programming language in this [data science](https://360digitmg.com/usa/data-science-using-python-and-r-programming-in-dallas "data science") certification training in Dallas, TX. You will master data...