# πŸ”„ Rsync `rsync` is a powerful command-line tool for syncing files and directories between systems over SSH. Here are some useful commands πŸ‘‡ --- ## πŸ“Œ Basic Syntax ```bash rsync [options] @: ``` or ```bash rsync [options] @: ``` --- ## πŸ“₯ Copy from Local ➝ Remote ```bash rsync file1.txt radin@192.168.1.10:/home/radin ``` Verbose mode (shows details): ```bash rsync -v file1.txt radin@192.168.1.10:/home/radin ``` --- ## πŸ“€ Copy from Remote ➝ Local ```bash rsync -v radin@192.168.1.10:/home/radin/file1.txt /opt ``` --- ## πŸ“¦ Archiving Archive mode (preserves permissions, symlinks, etc.): ```bash rsync -va file1.txt radin@192.168.1.10:/home/radin ``` Archive + compress (gzip): ```bash rsync -vaz file1.txt radin@192.168.1.10:/home/radin ``` With progress bar: ```bash rsync -vaz --progress file1.txt radin@192.168.1.10:/home/radin ``` --- ## πŸ” Custom SSH Port ```bash rsync -e 'ssh -p 8090' -vaz file1.txt radin@192.168.1.10:/home/radin ``` --- ## πŸ—‘οΈ Sync with Delete (mirror directories) Deletes files on destination that don’t exist on source: ```bash rsync -vaz --delete dir_test/ radin@192.168.1.10:/home/radin ``` --- ## 🚫 Excluding Files Exclude `.img` files: ```bash rsync -va dir_test/ --exclude '*.img' radin@192.168.1.10:/home/radin ``` --- ## ⚑ Bandwidth Control Limit transfer speed (in KB/s): ```bash rsync -v --bwlimit=2048 file1.txt radin@192.168.1.10:/home/radin ``` --- ## 🧹 Move Instead of Copy Remove source file after transfer: ```bash rsync -v --remove-source-file file1.txt radin@192.168.1.10:/home/radin ``` --- ## β›” Ignore Existing Files Skip already existing files: ```bash rsync -v --ignore-existing file1.txt radin@192.168.1.10:/home/radin ``` --- ## πŸ§Ήβ›” Combine Options Remove source + ignore existing: ```bash rsync -v --remove-source-file --ignore-existing file1.txt radin@192.168.1.10:/home/radin ```