{"id":1641,"date":"2024-02-27T00:00:00","date_gmt":"2024-02-27T05:00:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=1641"},"modified":"2024-02-02T14:38:45","modified_gmt":"2024-02-02T19:38:45","slug":"rsync-cheat-sheet","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/rsync-cheat-sheet\/","title":{"rendered":"rsync Cheat Sheet"},"content":{"rendered":"\n<p>Rsync is a powerful and versatile file synchronization tool for efficiently copying and transferring files between local and remote hosts. This cheat sheet provides essential Rsync commands for various use cases.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Introduction:<\/strong><\/h4>\n\n\n\n<p>Rsync is known for its ability to efficiently synchronize files and directories across different systems while minimizing data transfer. It uses the SSH protocol for secure remote transfers and supports a wide range of options for fine-tuned control.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Basic File Synchronization:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>rsync [source] [destination]<\/code><\/td><td>Synchronize files and directories locally.<\/td><\/tr><tr><td><code>rsync -av [source] [destination]<\/code><\/td><td>Archive mode: Preserves permissions and other attributes.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Synchronize with a Remote Server (Using SSH):<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>rsync -av -e ssh [source] [username]@[hostname]:[destination]<\/code><\/td><td>Synchronize with a remote server using SSH.<\/td><\/tr><tr><td><code>rsync -av --delete -e ssh [source] [username]@[hostname]:[destination]<\/code><\/td><td>Delete extraneous files on the destination.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Include and Exclude Files:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>rsync -av --include=[pattern] --exclude=[pattern] [source] [destination]<\/code><\/td><td>Include and exclude specific files based on patterns.<\/td><\/tr><tr><td><code>rsync -av --exclude-from=[file] [source] [destination]<\/code><\/td><td>Exclude files listed in a file.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Advanced Options:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>rsync -av --progress [source] [destination]<\/code><\/td><td>Display transfer progress.<\/td><\/tr><tr><td><code>rsync -av --bwlimit=[limit] [source] [destination]<\/code><\/td><td>Limit bandwidth usage during transfer.<\/td><\/tr><tr><td><code>rsync -av --dry-run [source] [destination]<\/code><\/td><td>Perform a dry run without making any changes.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Using Rsync Daemon:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>rsync -av [source] rsync:\/\/[username]@[hostname]\/[module]<\/code><\/td><td>Connect to an Rsync daemon on a remote server.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Backup with Rsync:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>rsync -av --link-dest=[backup_dir] [source] [backup_destination]<\/code><\/td><td>Create incremental backups using hard links.<\/td><\/tr><tr><td><code>rsync -av --delete --backup --backup-dir=[backup_dir] [source] [destination]<\/code><\/td><td>Perform backups with versioning.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Using Rsync for Bandwidth-Efficient Transfers:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>rsync -avz [source] [username]@[hostname]:[destination]<\/code><\/td><td>Enable compression for data transfer.<\/td><\/tr><tr><td><code>rsync -av --partial --progress [source] [destination]<\/code><\/td><td>Partially transfer files for resumable transfers.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p>Rsync is a versatile and efficient tool for file synchronization, whether you are working locally or remotely. This cheat sheet provides a quick reference for commonly used Rsync commands, covering basic file synchronization, remote transfers, include\/exclude options, and advanced features like backup and bandwidth-efficient transfers. Whether you are a system administrator or a developer, mastering these commands will enhance your ability to manage and synchronize files across different systems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rsync is a powerful and versatile file synchronization tool for efficiently copying and transferring files between local and remote hosts. This cheat sheet provides essential Rsync commands for various use cases. Introduction: Rsync is known for its ability to efficiently synchronize files and directories across different systems while minimizing data transfer. It uses the SSH [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,265],"tags":[35],"class_list":["post-1641","post","type-post","status-publish","format-standard","hentry","category-linux","category-reference","tag-linux"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=1641"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1641\/revisions"}],"predecessor-version":[{"id":1642,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1641\/revisions\/1642"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=1641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=1641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=1641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}