{"id":374,"date":"2022-07-09T11:13:22","date_gmt":"2022-07-09T11:13:22","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=374"},"modified":"2024-10-15T13:58:54","modified_gmt":"2024-10-15T13:58:54","slug":"how-to-use-rsync-to-copy-files-over-ssh","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/","title":{"rendered":"How to Use Rsync to Copy Files Over SSH"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en-1024x576.jpg\" alt=\"Use Rsync to Copy Files\" class=\"wp-image-820\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en-150x84.jpg 150w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Rsync, sometimes known as Remote Sync, is a free command-line utility that allows you to transfer files and directories to both local and remote locations. Rsync is used for mirroring, backups, and data migration to other servers.<\/p>\n\n\n\n<p>This program is quick and efficient, replicating only the changes from the source and allowing for customization.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Set up an SSH connection with the destination<\/strong> <strong>server<\/strong>.<\/h2>\n\n\n\n<p>Rsync over SSH can use a standard login with a password or <a href=\"https:\/\/www.webhi.com\/how-to\/how-to-use-a-private-key-for-ssh-authentication\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">a Private key for SSH authentication<\/mark><\/a><\/p>\n\n\n\n<p>In this example, I&#8217;m going to copy a file from Server A (192.168.182.130) located in \/root\/file-to-send.zip to Server B (192.168.182.131) and save it to \/root\/new-file.zip.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1 : Connect to server A and locate the file.<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ssh root@ServerA_ip\n$ ls<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading has-text-align-center\"><kbd>Output:<\/kbd><\/h5>\n\n\n\n<pre class=\"wp-block-preformatted\">root@local:~# ssh root@192.168.182.130\nroot@192.168.182.130's password:\nroot@ServerA:~# ls\nfile-to-send.zip<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2 : Use rsync to transfer the file.<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ rsync -avz \/root\/file-to-send.zip root@ServerB_ip:\/root\/new-file.zip<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading has-text-align-center\"><kbd>Output:<\/kbd><\/h5>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ServerA:~# rsync -avz \/root\/file-to-send.zip root@192.168.182.131:\/root\/new-file.zip\nsending incremental file list\nfile-to-send.zip\nsent 10,600 bytes received 35 bytes 21,270.00 bytes\/sec\ntotal size is 131,604 speedup is 12.37<\/pre>\n\n\n\n<p>When you transfer large files, it&#8217;s more user-friendly to have a progress bar with <kbd>--progress<\/kbd>.<\/p>\n\n\n\n<p>Our command will become : <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ rsync -avz \/root\/file-to-send.zip root@ServerB_ip:\/root\/new-file.zip --progress <\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading has-text-align-center\"><kbd>Output:<\/kbd><\/h5>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ServerA:~# rsync -avz \/root\/file-to-send.zip root@192.168.182.131:\/root\/new-file.zip --progress\nsending incremental file list\nfile-to-send.zip\n131,604 100% 94.26MB\/s 0:00:00 (xfr#1, to-chk=0\/1)\nsent 10,600 bytes received 35 bytes 7,090.00 bytes\/sec\ntotal size is 131,604 speedup is 12.37<\/pre>\n\n\n\n<p><kbd>-v, \u2013verbose:<\/kbd>This&nbsp;option&nbsp;is&nbsp;used&nbsp;if&nbsp;the&nbsp;user&nbsp;wishes&nbsp;to&nbsp;know&nbsp;what&nbsp;the&nbsp;computer&nbsp;is&nbsp;doing&nbsp;while&nbsp;running&nbsp;the&nbsp;command.<\/p>\n\n\n\n<p><kbd>-a, \u2013archive:<\/kbd>This option can be used to archive files when synchronization is taking place.<\/p>\n\n\n\n<p><kbd>-z, \u2013compress:<\/kbd>This option can be used to compress the file being transferred to reduce data usage during synchronization.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3 : Checking the transfer of file.<\/h3>\n\n\n\n<p>Finally, do not forget to verify that you have received the file on server B.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ssh rooot@ServerB_ip\n$ ls<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading has-text-align-center\"><kbd>Output :<\/kbd><\/h5>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ServerA:~# ssh root@192.168.182.131\nroot@ServerB:~# ls\nnew-file.zip snap<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Rsync, sometimes known as Remote Sync, is a free command-line utility that allows you to transfer files and directories to both local and remote locations. Rsync is used for mirroring, backups, and data migration to other servers. This program is quick and efficient, replicating only the changes from the source and allowing for customization. ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,279],"tags":[],"yoast_head":"\n<title>How to Use Rsync to Copy Files Over SSH - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"This program is quick and efficient, replicating only the changes from the source and allowing for customization.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use Rsync to Copy Files Over SSH - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"This program is quick and efficient, replicating only the changes from the source and allowing for customization.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-09T11:13:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-15T13:58:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en-1024x576.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"How to Use Rsync to Copy Files Over SSH\",\"datePublished\":\"2022-07-09T11:13:22+00:00\",\"dateModified\":\"2024-10-15T13:58:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\"},\"wordCount\":251,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Security\",\"Softwares and Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\",\"name\":\"How to Use Rsync to Copy Files Over SSH - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2022-07-09T11:13:22+00:00\",\"dateModified\":\"2024-10-15T13:58:54+00:00\",\"description\":\"This program is quick and efficient, replicating only the changes from the source and allowing for customization.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use Rsync to Copy Files Over SSH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"How to Use Rsync to Copy Files Over SSH - WebHi Tutorials &amp; Documentations","description":"This program is quick and efficient, replicating only the changes from the source and allowing for customization.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/","og_locale":"en_US","og_type":"article","og_title":"How to Use Rsync to Copy Files Over SSH - WebHi Tutorials &amp; Documentations","og_description":"This program is quick and efficient, replicating only the changes from the source and allowing for customization.","og_url":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2022-07-09T11:13:22+00:00","article_modified_time":"2024-10-15T13:58:54+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/rsync_en-1024x576.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"How to Use Rsync to Copy Files Over SSH","datePublished":"2022-07-09T11:13:22+00:00","dateModified":"2024-10-15T13:58:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/"},"wordCount":251,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Security","Softwares and Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/","url":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/","name":"How to Use Rsync to Copy Files Over SSH - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2022-07-09T11:13:22+00:00","dateModified":"2024-10-15T13:58:54+00:00","description":"This program is quick and efficient, replicating only the changes from the source and allowing for customization.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-rsync-to-copy-files-over-ssh\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"How to Use Rsync to Copy Files Over SSH"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/374"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":38,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":9514,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/374\/revisions\/9514"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}