Rakesh Jain
Rakesh Jain

@devops_tech

26 Tweets 2 reads Oct 08, 2023
What is Rsync! How it works!
A Thread with 15 most useful examples 👇
Rsync - Efficient File Synchronization 🔄
1/7: Rsync is a file synchronization tool used to copy and update files between different locations. It works by transferring only the differences between the source and destination, saving time & bandwidth.
#Rsync #FileSynchronization
2/7: When you run rsync, it compares file sizes and modification times to determine which files need to be updated. It then copies only the changed parts of the files, rather than transferring the entire file.
#Rsync #FileSynchronization
3/7: Rsync uses a delta encoding algorithm, which breaks files into small blocks. It calculates the differences between corresponding blocks in the source and destination files, transmitting only the changes.
#Rsync #FileSynchronization
4/7: Rsync employs a rolling checksum algorithm to identify matching blocks in different files. It divides files into fixed-size blocks and generates a checksum for each block. This allows it to quickly determine which blocks need to be transferred.
#Rsync #FileSynchronization
5/7: Rsync transfers the changed blocks and reassembles them at the destination, creating an exact replica of the source. This incremental approach minimizes the amount of data transferred, making it efficient for large files or slow connections.
#Rsync #FileSynchronization
6/7: Rsync can be used locally or over a network, and it supports secure transfers via SSH. It offers various options like bandwidth throttling, dry-run mode, and the ability to exclude files from the transfer.
#Rsync #FileSynchronization
7/7: In summary, rsync's intelligent delta encoding and block-level synchronization make it a powerful tool for efficiently copying and updating files. It saves time, reduces network usage, and simplifies file synchronization tasks. #Rsync #FileSynchronization
15 Rsync Examples for Efficient File Synchronization 🔄 👇
1/15: Copy files from local source to a local destination:
rsync /path/to/source /path/to/destination
2/15: Synchronize files between a local and remote machine over SSH:
rsync -e ssh /path/to/source user@remote:/path/to/destination
3/15: Exclude specific files or directories from the transfer:
rsync --exclude '*.txt' /path/to/source /path/to/destination
4/15: Use bandwidth throttling to limit transfer speed:
rsync --bwlimit=1000 /path/to/source /path/to/destination
5/15: Delete files from the destination that no longer exist in the source:
rsync --delete /path/to/source /path/to/destination
6/15: Preserve file permissions, timestamps, and metadata during transfer:
rsync -a /path/to/source /path/to/destination
7/15: Preserve symbolic links during the transfer:
rsync --links /path/to/source /path/to/destination
8/15: Display a progress bar during the transfer:
rsync --progress /path/to/source /path/to/destination
9/15: Update all files, ignoring differences, for small files or specific scenarios:
rsync --whole-file /path/to/source /path/to/destination
10/15: Specify a remote shell program and additional SSH options:
rsync -e "ssh -p 2222" /path/to/source user@remote:/path/to/destination
11/15: Compress files during the transfer to reduce data size:
rsync --compress /path/to/source user@remote:/path/to/destination
12/15: Dry-run mode to preview changes without actually performing the transfer:
rsync --dry-run /path/to/source /path/to/destination
13/15: Copy only newer or updated files:
rsync -u /path/to/source /path/to/destination
14/15: Transfer files while preserving extended attributes:
rsync -X /path/to/source /path/to/destination
15/15: Exclude specific file types from the transfer:
rsync --exclude '.jpg' --exclude '.png' /path/to/source /path/to/destination
Enjoy efficient file synchronization with rsync! 🚀 #Rsync #FileSynchronization
Retweet the thread if you find it useful. Thanks!

Loading suggestions...