Mastering Rsync: Efficient File Synchronization and Backup in Linux

rsync command in Linux- www.techiev.com rsync :          Rsync, which stands for " remote sync ", is a remote and local file...

rsync command in linux -www.techiev.com
rsync command in Linux- www.techiev.com

rsync:
         Rsync, which stands for "remote sync", is a remote and local file synchronization tool
         rsync used a "quick check algorithm" to transfer the files.
         It is used to copy and synchronize the files and directories locally as well as on two different servers.
         It is fast and secure and flexible.
         In real-time mostly used for server file Backup.
         It is the replacement of the RCP command.
         It will support the links, groups, and file permissions as well.
       
In the rsync command, there were several options available.

1. -r option:  Sync the content dir1 to dir2 in the same system
                   Syntax: rsync -r dir1/ dir2
 Where -r option is recursive

2. -a option: It stands for "archive" and syncs recursively and preserves symbolic links, special and device files, modification times, group, owner, and permissions.
Syntax: rsync -a dir1/ dir2
Where " -a " is a combination flag.

3. Trailing slash ( / ):  Using a trailing slash it will sync the file inside the directory when not used directory itself is transferred  
                   
4. -n or --dry-run: Double-check the argument before executing the sync command.
Syntax: rsync -anv dir1/ dir2
Example: With trailing slash(/)
rsync -anv man1/ man
Without trailing slash(/)
rsync -anv man1 man
5. -z option: If you are transferring files that have not already been compressed, like text files, you can reduce the network transfer by adding compression with the -z option

6. -p option: The -P flag is very helpful. It combines the flags --progress and --partial
Syntax: rsync -azP source destination

7. --delete option: Before using the delete option use -the dry-run option and do testing to prevent data loss Syntax: rsync -a --delete source destination

8.--exclude= option:  exclude certain files or directories located inside a directory you are syncing, you can do so by specifying them in a comma-separated list following the --exclude= option
            Syntax: rsync -a --exclude=pattern_to_exclude source destination

9. --include= option: we have specified a pattern to exclude, we can override that exclusion for files that match a different pattern by using the --include= option
             Syntax: rsync -a --exclude=pattern_to_exclude --include=pattern_to_include source destination

10.--backup option: rsync’s --backup option can be used to store backups of important files. It is used in conjunction with the --backup-dir option, which specifies the directory where the backup files should be stored.
Syntax: Syntax: rsync -a --delete --backup --backup-dir=/path/to/backups /path/to/source destination

Rsync to sync with a remote system:
1. SSH access to the remote machine and rsync installed on both sides
2. Must set up SSH keys

1. Push operation:
              Pushes the directory or folder or file from the local machine to the remote machine
2. pull operation:
              sync a remote directory to the local system.
          Syntax: push operation:
                 rsync -a ~/dir1 username@remote_host:destination_directory
          Syntax: pull operation:
                 rsync -a username@remote_host:/home/username/dir1 place_to_sync_on_local_machine

----------------------------------------!!!! Happy Learning with Techiev !!!!!!!!---------------------------------

------------------------Subscribe our Youtube Channel by clicking the below link---------------------- ----------------------------!!https://www.youtube.com/@techieview729!!---------------------

Name

AWS,14,Devops,23,linux,9,
ltr
item
Techie View: Mastering Rsync: Efficient File Synchronization and Backup in Linux
Mastering Rsync: Efficient File Synchronization and Backup in Linux
https://1.bp.blogspot.com/-Rf8ps_w3PPg/XcGoBwpEBWI/AAAAAAAAADE/tT2B9TRWkZM3Zc0B8aQ-yGlChR1gOGOEwCLcBGAsYHQ/s400/images.jpg
https://1.bp.blogspot.com/-Rf8ps_w3PPg/XcGoBwpEBWI/AAAAAAAAADE/tT2B9TRWkZM3Zc0B8aQ-yGlChR1gOGOEwCLcBGAsYHQ/s72-c/images.jpg
Techie View
https://www.techiev.com/2019/11/rsync-command-in-linux.html
https://www.techiev.com/
https://www.techiev.com/
https://www.techiev.com/2019/11/rsync-command-in-linux.html
true
7013663511659419322
UTF-8
Loaded All Posts Not found any posts VIEW ALL View Full Article Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy