What is Linux RSYNC

rsync is a command-line tool used for synchronizing files and directories between two locations. It is highly efficient and widely used for tasks such as backups, file transfers, and mirroring. The key feature of rsync is its ability to transfer only the parts of a file that have changed, rather than transferring the entire file. This makes it fast and efficient, especially when dealing with large datasets.

Key Features of rsync:

  1. Efficient Transfers: It uses a method called delta encoding, which only transfers the differences between source and destination files. This reduces the amount of data transferred, speeding up the process.
  2. Local and Remote Synchronization: rsync can be used to sync files between local directories, or between a local directory and a remote server using protocols like SSH.
  3. Preservation of File Metadata: It can preserve file permissions, timestamps, symbolic links, and other attributes during transfer.
  4. Incremental Backups: When used for backups, rsync only copies files that have changed since the last sync, saving time and bandwidth.
  5. Compression: Data can be compressed during transfer, which is useful when syncing over a network.
  6. Flexible Options: rsync comes with a variety of options, allowing for fine-grained control over file transfer behavior, including excluding specific files, deleting files from the destination, or performing dry runs to simulate transfers.

How It Works:

When you run rsync, it compares the source and destination files and only copies over the files or parts of files that are different. It can be used for local transfers between directories on the same machine or remote transfers over SSH or other remote protocols.

rsync -v file1.csv root@10.10.10.100:/tmp/rsync <Remote server IP:/rsync Means Remote Server Destination Folder>
rsync -vz –progress file1.csv root@10.10.10.100:/tmp/rsync
rsync -vzab –progress –backup-dir=/tmp/rsync/archive/ file1.csv root@10.10.10.100:/tmp/rsync
rsync -vzab –progress –backup-dir=/tmp/rsync/archive/$ file1.csv root@10.10.10.100:/tmp/rsync