{"id":457441,"date":"2022-06-03T21:00:54","date_gmt":"2022-06-03T18:00:54","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-use-the-scp-command-on-linux\/"},"modified":"2022-06-03T21:00:54","modified_gmt":"2022-06-03T18:00:54","slug":"how-to-use-the-scp-command-on-linux","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/","title":{"rendered":"#How to Use the scp Command on Linux"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2545e9e4dfe\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2545e9e4dfe\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#%E2%80%9CHow_to_Use_the_scp_Command_on_Linux%E2%80%9D\" >&#8220;How to Use the scp Command on Linux&#8221;<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#The_Secure_Copy_Protocol_and_scp\" >The Secure Copy Protocol and scp<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#Copying_a_Single_File\" >Copying a Single File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#Retrieving_a_Single_File\" >Retrieving a Single File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#Copying_Multiple_Files\" >Copying Multiple Files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#Recursively_Copying_Directories\" >Recursively Copying Directories<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#Copying_Files_Between_Remote_Servers\" >Copying Files Between Remote Servers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-the-scp-command-on-linux\/#Other_Options\" >Other Options<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E2%80%9CHow_to_Use_the_scp_Command_on_Linux%E2%80%9D\"><\/span>&#8220;How to Use the scp Command on Linux&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<div>\n<figure style=\"width: 1200px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage size-full wp-image-770699\" data-pagespeed-lazy-srcset=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/11\/shutterstock_1278851809.png?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/11\/shutterstock_1278851809.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/11\/shutterstock_1278851809.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Linux terminal on a laptop screen.\" width=\"1200\" height=\"675\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><figcaption class=\"wp-caption-text\"><span class=\"type:primaryImage imagecredit\"><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.shutterstock.com\/image-vector\/command-line-interface-cli-programming-language-1278851809\">fatmawati achmad zaenuri\/Shutterstock.com<\/a><\/span><\/figcaption><\/figure>\n<p>The <code>scp<\/code> command makes copying files between Linux computers easy and secure. It uses SSH security, but best of all, it is simple. If you can use <code>cp<\/code>, you can use <code>scp<\/code>.<\/p>\n<h2 id=\"the-secure-copy-protocol\"><span class=\"ez-toc-section\" id=\"The_Secure_Copy_Protocol_and_scp\"><\/span>The Secure Copy Protocol and scp<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let\u2019s define a couple of terms: there\u2019s SCP and there\u2019s <code>scp<\/code>. The uppercase SCP stands for the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Secure_copy_protocol\">Secure Copy Protocol<\/a>. The lowercase <code>scp<\/code> stands for secure <code>cp<\/code>.\u00a0In other words, SCP is a protocol and <code>scp<\/code> is a program.<\/p>\n<p><code>scp<\/code> was designed to be a safe and secure means of copying files between remote Linux computers. It uses SSH to establish secure connections. SSH, or secure shell, is a cryptographic network protocol often used to access and log in to remote Linux computers. On Linux distributions, SSH functionality is provided by OpenSSH.<\/p>\n<p>SCP is somewhat long in the tooth, and concerns have been aired concerning its use in the present day. Since OpenSSH version 8.8, SCP has been considered deprecated. Modern implementations of <code>scp<\/code> default to using the Secure File Transfer Protocol by default. SSH is still used for the secure connection, but the file transfers are handled by SFTP. This is all invisible and h<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>ens magically under the hood, and the <code>scp<\/code> syntax has remained the same.<\/p>\n<p>The <code>rsync<\/code> program is preferred over <code>scp<\/code> , but you may encounter a computer that doesn\u2019t have <code>rsync<\/code> installed, and for which you don\u2019t have root privileges meaning you can\u2019t go ahead and install it. For copying files from computer to computer on a self-contained network, <code>scp<\/code> is perfectly fine. For <code>scp<\/code> to work, you must have SSH running on all of the computers you\u2019ll be copying to and from.<\/p>\n<p>To see the version of OpenSSH installed on your computer, type:<\/p>\n<pre>ssh -V<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804181\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/0.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Obtaining the version of OpenSSH\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2 id=\"copying-a-single-file\"><span class=\"ez-toc-section\" id=\"Copying_a_Single_File\"><\/span>Copying a Single File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Like the standard <code>cp<\/code> command, <code>scp<\/code> copies files from the\u00a0<em>source<\/em>\u00a0location to the\u00a0<em>target<\/em>\u00a0location. To copy a file to a remote computer, you must know the IP address or network name of the remote computer. You must also have the credentials for a user account that has write privileges for the location you\u2019re sending the file to.<\/p>\n<p>To send a file called \u201csample.txt\u201d to a computer called \u201cfedora-34\u201d on the local network, the syntax is:<\/p>\n<pre>scp .\/sample.txt dave@fedora-34.local:\/home\/dave\/Downloads\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804186\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/1-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying a single file to a remote computer\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The command is made up of:<\/p>\n<ul>\n<li><strong>scp<\/strong>: The scp command<\/li>\n<li><strong>.\/sample.txt<\/strong>: The file we\u2019re going to send. This is in the current directory.<\/li>\n<li><strong>dave@<\/strong>: The user account on the remote computer we\u2019re going to send the file to.<\/li>\n<li><strong>fedora-34.local<\/strong>: The network name of the remote computer.<\/li>\n<li><strong>:\/home\/dave\/Downloads\/<\/strong>: The location to copy the file to on the remote computer. Note the colon \u201c:\u201d that separates the computer name and the path.<\/li>\n<\/ul>\n<p>You\u2019ll be prompted to enter the password for the account on the remote computer, and then the file is copied.<\/p>\n<p>If you want the file to have a different name on the remote computer, you can add a filename to the target path. To copy the same file and have it named \u201cdifferent-file.txt\u201d, use this syntax:<\/p>\n<pre>scp .\/sample.txt dave@fedora-34.local:\/home\/dave\/Downloads\/different-file.txt<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804187\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/2-2.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying a single file to a remote computer with a new name\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The <code>scp<\/code> command will silently overwrite existing files, so be careful when you\u2019re copying files. If a file already exists on the target computer with the same name as the file you\u2019re copying, it will be overwritten and lost.<\/p>\n<p>If the target computer isn\u2019t using the default SSH port of 22, you can use the <code>-P<\/code> (port number) option to provide the appropriate port number.<\/p>\n<h2 id=\"retrieving-a-single-file\"><span class=\"ez-toc-section\" id=\"Retrieving_a_Single_File\"><\/span>Retrieving a Single File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To copy a file <em>from<\/em> a remote server, simply put the remote server as the source, and put the local path where you want the file copied as the target. We\u2019re going to copy a file called \u201cdevelopment-plan.md\u201d from the remote computer to the current directory on the local computer.<\/p>\n<pre>scp dave@fedora-34.local:\/home\/dave\/Downloads\/development-plan.md .<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804188\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/3-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying a single file from a remote server to the current directory of the local computer\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>If you add a filename to the local path, the file is copied and given that name.<\/p>\n<pre>scp dave@fedora-34.local:\/home\/dave\/Downloads\/development-plan.md .\/dp-1.md<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804189\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/4-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying a single file from a remote server to the current directory of the local computer with a new name\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The file is copied but renamed to our specified filename.<\/p>\n<pre>ls -hl *.md<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804190\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/5-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"110\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2 id=\"copying-multiple-files\"><span class=\"ez-toc-section\" id=\"Copying_Multiple_Files\"><\/span>Copying Multiple Files<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Copying multiple files in either direction is easy. You can list as many source files as you like. Here, we\u2019re copying two markdown files and a CSV file.<\/p>\n<pre>scp .\/dp-1.md .\/dp-2.md .\/dp-3.csv dave@fedora-34.local:\/home\/dave\/Downloads\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804192\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/6-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying multiple named files to a remote computer\" width=\"644\" height=\"169\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The three files are copied to the remote computer. You can also use wildcards. This command does exactly the same thing as the last command.<\/p>\n<pre>scp .\/dp<em>.<\/em>\u00a0dave@fedora-34.local:\/home\/dave\/Downloads\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804194\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/7-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying multiple files to a remote computer using wildcards in the filename\" width=\"644\" height=\"170\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2 id=\"recursively-copying-directories\"><span class=\"ez-toc-section\" id=\"Recursively_Copying_Directories\"><\/span>Recursively Copying Directories<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>-r<\/code> (recursive) option lets you copy entire directory trees with a single command. We\u2019ve placed two files in a directory called \u201cdata\u201d and created a directory called \u201cCSV\u201d inside the \u201cdata\u201d directory. We placed a CSV file in the \u201cdata\/CSV\u201d directory.<\/p>\n<p>This command copies the files and recreates the directory structure on the remote computer.<\/p>\n<pre>scp -r .\/data dave@fedora-34.local:\/home\/dave\/Downloads\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804196\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/8-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying a directory tree to a remote computer\" width=\"644\" height=\"170\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2 id=\"copying-files-between-remote-servers\"><span class=\"ez-toc-section\" id=\"Copying_Files_Between_Remote_Servers\"><\/span>Copying Files Between Remote Servers<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can even instruct <code>scp<\/code> to copy files from one remote server to another. The syntax is pretty simple. You provide the account name and network address of the source server and the account name and network address of the target server. The files are copied from the source server and copied to the location on the target server.<\/p>\n<p>Although the syntax is simple, ensuring everything else is in place takes a bit more thought. Obviously, the location you\u2019re trying to copy the files to on the remote server must be accessible by the user account you specify on the command line. And that user account must have write permissions on that location.<\/p>\n<p>A more subtle prerequisite is that SSH access must be set up between your local computer and the source computer, and also between the source and target servers. Ensure that you can use SSH to log in to the target server\u00a0<em>from the source server<\/em>. If you can\u2019t do that, <code>scp<\/code> won\u2019t be able to connect.<\/p>\n<p>Setting up SSH keys so that you can use authenticated but passwordless access is by far the preferred method. Using passwords becomes messy very quickly, and\u2014because you\u2019re prompted for the password for each user account\u2014it prevents you from fully automating the process with a script.<\/p>\n<p>We set up SSH keys for the user accounts we\u2019re using on each remote server. This provided seamless SSH access to the other server, for those two users. This allows us to transfer files in either direction, using those two user accounts.<\/p>\n<p>To copy files from the \u201cdavem\u201d user account on a Manjaro computer to the \u201cdave\u201d account on a Fedora computer, via an <code>scp<\/code> command issued from our local Ubuntu computer, the syntax is:<\/p>\n<pre>scp davem@manjaro20-0-1.local:\/home\/davem\/man<em>.<\/em>\u00a0dave@fedora-34.local:\/home\/dave\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804199\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/9-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying files from one remote server to another.\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>We\u2019re silently returned to the command line. There\u2019s no indication anything happened. Working on the premise that no <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/news\/\" data-internallinksmanager029f6b8e52c=\"2\" title=\"News\" target=\"_blank\" rel=\"noopener\">news<\/a> is good news, <code>scp<\/code> only reports on errors for this remote to remote copying. On checking the Fedora computer we can see that the files from the Manjaro computer have been copied and received.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804202\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/10-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Files from the Manjaro computer received on the Fedora computer\" width=\"644\" height=\"270\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>By default, the files are copied directly from the source computer to the target computer. You can override this using the <code>-3<\/code> (three-way) option.<\/p>\n<p>With this option, the files are transferred from the target to the source, through your local computer. For that to happen, there needs to be seamless SSH access from your local computer to the target computer.<\/p>\n<pre>scp -3 davem@manjaro20-0-1.local:\/home\/davem\/man<em>.<\/em>\u00a0dave@fedora-34.local:\/home\/dave\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804215\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/05\/11-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Copying files from one remote server to another, through the local computer\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>There\u2019s still no indication anything has happened, even when channeling the files through your local computer. The proof of the pudding, of course, is to check the target computer.<\/p>\n<h2 id=\"other-options\"><span class=\"ez-toc-section\" id=\"Other_Options\"><\/span>Other Options<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>-p<\/code> (preserve file attributes) will keep the original file creation, ownership, and access flags on the transferred files. They\u2019ll have the same metadata as the original files on the source computer.<\/p>\n<p>If you see error messages, try repeating the command and use the <code>-v<\/code> (verbose) flag to see detailed information about the transfer attempt. You ought to be able to spot the point of failure in the output.<\/p>\n<p>The <code>-C<\/code> (compress) option compresses the files as they are copied and decompresses them when they\u2019re received. This is something that dates back to the era of slow modem communications between computers. Reducing the size of the payload could reduce transmission times.<\/p>\n<p>Nowadays, the time taken to compress and decompress the files is likely to take longer than the difference between the compressed and uncompressed transmissions. But because <code>scp<\/code> is best used to copy files between computers on the same LAN, transmission speed shouldn\u2019t be much of a concern.<\/p>\n<p><strong>RELATED:<\/strong> <strong><em>How to Back Up Your Linux System With rsync<\/em><\/strong><\/p>\n<\/div>\n<p><script>\n setTimeout(function(){\n  !function(f,b,e,v,n,t,s)\n  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n  n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n  n.queue=[];t=b.createElement(e);t.async=!0;\n  t.src=v;s=b.getElementsByTagName(e)[0];\n  s.parentNode.insertBefore(t,s) } (window, document,'script',\n  'https:\/\/connect.facebook.net\/en_US\/fbevents.js');\n   fbq('init', '335401813750447');\n   fbq('track', 'PageView');\n  },3000);\n<\/script><\/p>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.howtogeek.com\/804179\/scp-command-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;How to Use the scp Command on Linux&#8221; fatmawati achmad zaenuri\/Shutterstock.com The scp command makes copying files between Linux computers easy and secure. It uses SSH security, but best of all, it is simple. If you can use cp, you can use scp. The Secure Copy Protocol and scp Let\u2019s define a couple of terms:&#8230;<\/p>\n","protected":false},"author":1,"featured_media":457442,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/11\/shutterstock_1278851809.png?height=200p&trim=2,2,2,2","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-457441","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/457441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=457441"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/457441\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/457442"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=457441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=457441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=457441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}