Rsync CentOS 7: Sync & Backup Files

Here are some common examples of rsync commands that can be used in CentOS7 for synchronizing and backing up files.

  1. Sync local folder to remote server.
rsync -avz /path/to/source/ username@remote.server:/path/to/destination/
  1. Sync files from remote server to local folder.
rsync -avz username@remote.server:/path/to/source/ /path/to/destination/
  1. Back up a local folder to another local folder.
rsync -avz /path/to/source/ /path/to/destination/
  1. Incremental backup:
rsync -avz --backup --backup-dir=/path/to/backup/dir /path/to/source/ /path/to/destination/
  1. Synchronize folders while excluding certain files or folders.
rsync -avz --exclude='file.txt' /path/to/source/ /path/to/destination/

Here are some common examples of rsync commands that you can customize based on your needs. The meaning of the parameters in the rsync command is as follows:

  1. a: indicates archive mode, preserving file attributes and directory structure.
  2. -v: indicates verbose mode, displaying the file synchronization process in detail.
  3. -z: indicates compressing data for transmission.
  4. -backup: indicates backup mode, preserving backup versions of the source files.
  5. – Specify the directory for storing backup files with the option “backup-dir.”
  6. – exclude: exclude specified files or folders

To learn more about the parameters and usage of the rsync command, you can enter “man rsync” in the terminal to view the help documentation.

bannerAds