{"id":15545,"date":"2022-01-08T10:32:58","date_gmt":"2022-01-08T10:32:58","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15545"},"modified":"2025-01-09T09:16:49","modified_gmt":"2025-01-09T09:16:49","slug":"linux-scp-command","status":"publish","type":"post","link":"\/uk\/tutorials\/linux-scp-command","title":{"rendered":"How to Use SCP Command to Copy and Transfer Files in Linux"},"content":{"rendered":"<p>Secure copy protocol (SCP) is a command that enables efficient and secure file transfers between two systems over a network. It uses Secure Shell (SSH) to authenticate the systems and encrypt your data.<\/p><p>The SCP command streamlines data transfer between Linux systems since administrators don&rsquo;t need to log in to both servers. In addition, it is more secure than other methods like file transfer protocol (FTP), which is also commonly used for managing a remote system.<\/p><p>In this article, you&rsquo;ll learn how to use the SCP command on a remote host, such as a virtual private server (VPS). We will break down the command&rsquo;s syntax and provide SCP examples to help you better understand how it works.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Linux-Commands-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"1024\" height=\"283\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet-1024x283.png\" alt=\"\" class=\"wp-image-69262\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/Linux-cheat-sheet-1536x425.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/Linux-cheat-sheet-300x83.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/Linux-cheat-sheet-150x41.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/Linux-cheat-sheet-768x212.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/Linux-cheat-sheet.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-scp-command-syntax\">SCP Command Syntax<\/h2><p>The basic SCP syntax for transferring a file between two different remote servers is as follows:<\/p><pre class=\"wp-block-preformatted\">scp [options] [source username@IP]:\/[directory and file name] [destination username@IP]:\/[destination directory]<\/pre><p>Here&rsquo;s the command breakdown:<\/p><ul class=\"wp-block-list\">\n<li><strong>[options]<\/strong> &#8210; modifiers to alter the SCP command&rsquo;s behavior.<\/li>\n\n\n\n<li><strong>[source username@IP]<\/strong> &#8210; the source system&rsquo;s username and IP address.<\/li>\n\n\n\n<li><strong>:\/<\/strong> &ndash; the system address and directory path separator.<\/li>\n\n\n\n<li><strong>[directory and file name]<\/strong> &#8210; the file&rsquo;s location and name.<\/li>\n\n\n\n<li><strong>[destination username@IP]<\/strong> &#8210; the destination system&rsquo;s user account and IP address.<\/li>\n\n\n\n<li><strong>[destination directory]<\/strong> &#8210; the transferred files&rsquo; target directory.<\/li>\n<\/ul><p>Here&rsquo;s an example of an SCP command for copying files between two remote systems:<\/p><pre class=\"wp-block-preformatted\">scp root@162.168.1.1:\/media\/scp.png hostinger@162.168.1.2:\/desktop\/destination<\/pre><p>Ensure to enable <strong>root<\/strong> access on the remote machine. If you use another account, check whether it has the <strong>write <\/strong>permission for the target folder. Otherwise, you can only transfer files to the user&rsquo;s home directory.<\/p><p>If you&rsquo;re copying to or from a local host, omit the IP address and the path like <strong>\/desktop\/folder_name<\/strong>. The command will look as follows:<\/p><pre class=\"wp-block-preformatted\">scp scp.png hostinger@162.168.1.2:\/desktop\/destination<\/pre><h2 class=\"wp-block-heading\" id=\"h-how-to-copy-files-using-the-scp-command\">How to Copy Files Using the SCP Command<\/h2><p>The following sections will explore some SCP practical usage examples for transferring files between different systems.<\/p><p>\n\n\n    <p class=\"warning\">\n        <strong>Warning!<\/strong> Be careful when using SCP commands since you may overwrite files and directories with the same name.    <\/p>\n    \n\n\n\n<\/p><h3 class=\"wp-block-heading\">Using SCP Command with Hostinger VPS<\/h3><p>You must access the source machine&rsquo;s bash shell to run the SCP command. For a remote server like a VPS, <a href=\"\/uk\/tutorials\/how-to-use-putty-ssh\">connect via SSH using PuTTY<\/a> or your computer&rsquo;s Terminal.<\/p><p>If you use Hostinger&rsquo;s <a href=\"\/uk\/vps-hosting\">VPS hosting<\/a>, utilize the <strong>Browser terminal <\/strong>feature in the server overview menu of the <strong>Members Area<\/strong>. It lets you connect and run commands on a remote server directly via a web browser, making the task more efficient.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/uk\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Moreover, our Browser terminal uses the VNC protocol to access the remote server, letting you run <a href=\"\/uk\/tutorials\/ssh\/basic-ssh-commands\">SSH commands<\/a> like SCP even when the target system closes the connection port.<\/p><p><strong>Kodee<\/strong>, Hostinger&rsquo;s AI assistant, is accessible from the server overview menu. This feature lets you use simple prompts to generate ready-to-use SCP commands based on your needs, improving management efficiency.<\/p><p>For example, you can input &ldquo;Generate the SCP command to transfer the <strong>config.yaml<\/strong> file from my current server&rsquo;s <strong>\/web_app\/configuration<\/strong> path to the <strong>\/live_app\/config<\/strong> remote directory in my VPS. The destination server&rsquo;s username is <strong>root<\/strong>, and its IP address is <strong>168.162.1.2<\/strong>.&rdquo;<\/p><p>Kodee will output the complete command, which you can copy and paste into the Browser terminal, like the following:<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69e03d6a8fe9b\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"502\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/10\/scp-command-generated-by-kodee-1024x502.png\" alt=\"Kodee generates SCP command based on the user's prompt\" class=\"wp-image-117105\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/10\/scp-command-generated-by-kodee-1024x502.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/10\/scp-command-generated-by-kodee-300x147.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/10\/scp-command-generated-by-kodee-150x73.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/10\/scp-command-generated-by-kodee-768x376.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/10\/scp-command-generated-by-kodee-1536x752.png 1536w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/10\/scp-command-generated-by-kodee-2048x1003.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\">Copying From a Local Server to a Remote Host<\/h3><p>Using the SCP command to copy files from a local system to a remote host like a VPS helps streamline web application deployment processes. It lets you quickly push the updated files from a local development environment to the live server.<\/p><p>For example, we&rsquo;ll copy the <strong>scp.zip<\/strong> local file to a remote server with the <strong>root <\/strong>user. To do so, specify the remote username and IP address:<\/p><pre class=\"wp-block-preformatted\">scp \/users\/Hostinger\/desktop\/scp.zip root@162.168.1.2:\/writing\/article<\/pre><p>Terminal will ask you to enter the remote machine&rsquo;s user password if you haven&rsquo;t set up an <a href=\"\/uk\/tutorials\/ssh\/how-to-set-up-ssh-keys\">SSH key pair<\/a>. It will also show a progress meter, like the following:<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/terminal-outputs-password-confirmation-and-progress-bar.png\"><img decoding=\"async\" width=\"944\" height=\"44\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/terminal-outputs-password-confirmation-and-progress-bar.png\" alt=\"Terminal outputs a password confirmation prompt and an SCP progress bar\" class=\"wp-image-96688\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-password-confirmation-and-progress-bar.png 944w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-password-confirmation-and-progress-bar-300x14.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-password-confirmation-and-progress-bar-150x7.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-password-confirmation-and-progress-bar-768x36.png 768w\" sizes=\"(max-width: 944px) 100vw, 944px\" \/><\/a><\/figure><\/div><p>Once finished, you can use the <a href=\"\/uk\/tutorials\/how-to-unzip-files-linux\/\">Linux unzip command<\/a> in the destination system&rsquo;s Terminal to extract the file<\/p><p>The SCP command relies on the default SSH port <strong>22<\/strong> to securely copy files. However, server administrators may set up another listening port to avoid unauthorized access. In this case, add the <strong>-P<\/strong> option to enable the SCP custom port:<\/p><pre class=\"wp-block-preformatted\">scp -P 2322 \/users\/Hostinger\/desktop\/scp.zip root@162.168.1.2:\/writing\/article<\/pre><p>To change the transmitted file name, specify the new value in your destination directory. Here&rsquo;s an example of the SCP command that renames <strong>scp.zip <\/strong>to <strong>howtoscp.zip<\/strong>:<\/p><pre class=\"wp-block-preformatted\">scp \/users\/Hostinger\/desktop\/scp.zip root@162.168.1.2:\/writing\/article\/howtoscp.zip<\/pre><p>Moreover, the SCP command lets you copy directories recursively, allowing you to transfer multiple files within a folder simultaneously. To do so, use <strong>scp -r<\/strong> and specify the folder you want to transfer:<\/p><pre class=\"wp-block-preformatted\">scp -r \/users\/Hostinger\/desktop root@162.168.1.2:\/writing\/article<\/pre><p>The command example above will copy the <strong>desktop <\/strong>folder&rsquo;s content to the <strong>\/writing\/article<\/strong> remote directory, including the subfolders. Alternatively, copy multiple files using their names like the following:<\/p><pre class=\"wp-block-preformatted\">scp file1.txt file2.txt file3.txt root@162.168.1.2:\/writing\/article<\/pre><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Pro Tip<\/h4>\n                    <p>To find a directory&rsquo;s full path, navigate to the appropriate directory and use the <strong>pwd<\/strong> command.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\">Transferring a Remote File to a Local Machine<\/h3><p>To initiate SCP data transfer from remote to local systems, switch the source and destination placement in the syntax. It improves your application development efficiency as you can easily download and work on the project file offline.<\/p><p>For example, use the following command to pull the <strong>scp.zip<\/strong> file from a remote VPS to a local machine:<\/p><pre class=\"wp-block-preformatted\">scp root@162.168.1.2:\/writing\/articles\/SCP.zip Users\/Hostinger\/Desktop<\/pre><p>Running this command will prompt the SSH login output, which requires the user password. If you disable the authentication using sudo privileges on the remote server and enable the public key authentication, the prompt won&rsquo;t appear.<\/p><h3 class=\"wp-block-heading\">Safely Moving a File Between Remote Hosts<\/h3><p>In addition to transferring to or from the current server, use SCP to move files between two remote Linux machines. To do so, run the command on your local computer with their address as the source and destination.<\/p><p>If you have multiple projects hosted on different remote machines, doing this helps improve efficiency. Instead of logging in to multiple systems individually, you can transfer files between them directly from your current computer.<\/p><p>For instance, run the following to transfer the <strong>scp.zip <\/strong>remote<strong> <\/strong>file from <strong>root@162.168.1.2<\/strong> to <strong>hostinger@162.168.1.1<\/strong>:<\/p><pre class=\"wp-block-preformatted\">scp root@162.168.1.2:\/writing\/article\/scp.zip hostinger@162.168.1.1:\/publishing<\/pre><p>Copying files between two remote servers requires both accounts&rsquo; SSH passwords.<\/p><p>By default, the SCP command transmits the data directly from the first remote computer to the second one. If you want to reroute the operation through your current local system, add the <strong>-3<\/strong> option as shown in the following command:<\/p><pre class=\"wp-block-preformatted\">scp -3 root@162.168.1.2:\/writing\/article\/scp.zip hostinger@162.168.1.1:\/publishing<\/pre><p>Use this option if you encounter a network error during the transfer. It usually occurs when the source system can&rsquo;t access the target system to copy data due to the lack of direct connection.<\/p><p>Rerouting the SCP command to the local host prompts the target server to receive files from your computer instead of the source system. However, this process will take longer and omit information like the progress bar.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-the-scp-command-with-options\">How to Use the SCP Command With Options<\/h2><p>There are several <a href=\"https:\/\/linux.die.net\/man\/1\/scp\" target=\"_blank\" rel=\"noreferrer noopener\">SCP command options<\/a>, which are parameters for modifying the data transfer behavior. They are helpful for users with advanced technical knowledge who want to copy the file in a specific manner according to their needs and security requirements.<\/p><p>Options can come in a single-character form (<strong>-o<\/strong>) and their descriptive equivalent (<strong>&ndash;option<\/strong>). Both work similarly, but some command utilities may not provide the short version.<\/p><p>Unlike other <a href=\"\/uk\/tutorials\/linux-commands\">Linux commands<\/a>, you can&rsquo;t use the<strong> &ndash;help<\/strong> parameter to display SCP&rsquo;s manual and acceptable options. Instead, you can do so by running it without any parameters:<\/p><pre class=\"wp-block-preformatted\">scp<\/pre><p>A commonly used SCP command option is <strong>-q<\/strong>, which prompts the system to copy the file in quiet mode. It disables the progress meter output, warnings, and diagnostic messages. Here&rsquo;s an example command:<\/p><pre class=\"wp-block-preformatted\">scp -q \/users\/Hostinger\/desktop\/scp.zip root@162.168.1.2<\/pre><p>Use the <strong>-v<\/strong> parameter to enable verbose output. It shows detailed debugging messages about the copying process for easier error troubleshooting. Here&rsquo;s how the command looks:<\/p><pre class=\"wp-block-preformatted\">scp -v \/users\/Hostinger\/desktop\/scp.zip root@162.168.1.2<\/pre><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/terminal-outputs-debug-messages-for-scp-command-verbose-mode.png\"><img decoding=\"async\" width=\"961\" height=\"308\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/terminal-outputs-debug-messages-for-scp-command-verbose-mode.png\" alt=\"Terminal outputs debug messages for SCP command's verbose mode\" class=\"wp-image-96689\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-debug-messages-for-scp-command-verbose-mode.png 961w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-debug-messages-for-scp-command-verbose-mode-300x96.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-debug-messages-for-scp-command-verbose-mode-150x48.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/01\/terminal-outputs-debug-messages-for-scp-command-verbose-mode-768x246.png 768w\" sizes=\"(max-width: 961px) 100vw, 961px\" \/><\/a><\/figure><\/div><p>The <strong>-4<\/strong> and <strong>-6<\/strong> options determine the internet protocol version used for data transmission &ndash; <a href=\"\/uk\/tutorials\/ipv4-vs-ipv6\">IPv4 or IPv6<\/a>. When using them, change the remote locations&rsquo; address accordingly, like the following example:<\/p><pre class=\"wp-block-preformatted\">scp -4 root@162.168.1.2:\/users\/Hostinger\/desktop\/scp.zip<\/pre><p>Use the <strong>-p<\/strong> option to preserve the source file data, like mode, modification, and access times. Note that it differs from the uppercase<strong> -P<\/strong> option for changing the transfer port. Here&rsquo;s the syntax:<\/p><pre class=\"wp-block-preformatted\">scp -p \/users\/Hostinger\/desktop\/scp.zip root@162.168.1.2<\/pre><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> Be careful when using the SCP command options as they are case-sensitive.<\/p><\/div>\n\n\n\n<\/p><p>The <strong>-C<\/strong> option compresses the copied files or directories during the transfer process. It works with all files except archives, such as <strong>.zip<\/strong> and <strong>.rar<\/strong>. Here&rsquo;s how the command looks:<\/p><pre class=\"wp-block-preformatted\">scp -C Folder root@162.168.1.2<\/pre><p>Meanwhile, the lowercase <strong>-c<\/strong> option lets you specify the client machine&rsquo;s encryption algorithm. It is set to <strong>AnyStdCipher <\/strong>by default, but you can use other values like <strong>aes256-ctr<\/strong>, <strong>aes256-cbc<\/strong>, and <strong>3des-cbc<\/strong>.<\/p><p>To check all the available values, refer to the <strong>Ciphers<\/strong> section in the <a href=\"https:\/\/linux.die.net\/man\/5\/ssh_config\" target=\"_blank\" rel=\"noreferrer noopener\">SSH_config manual<\/a>. Here&rsquo;s an SCP command example with <strong>3des-cbc <\/strong>encryption:<\/p><pre class=\"wp-block-preformatted\">scp -c 3des-cbc \/users\/Hostinger\/desktop\/scp.zip root@162.168.1.2<\/pre><p>If you want to copy a file in a particular manner but the SCP command doesn&rsquo;t have a suitable option, use the<strong> -o<\/strong> option. It lets you apply the SSH options in the configuration file to your SCP command.<\/p><p>To use the option, add the setting&rsquo;s key and value pair in quotation marks, like the following syntax example:<\/p><pre class=\"wp-block-preformatted\">scp -o \"option=value\" \/directory\/path\/file<\/pre><p>Each <strong>-o<\/strong> option only takes one pair as its value. If you want to pass multiple SSH settings, add more options. For example, the following SCP command will connect to the destination system a maximum of two times and timeout the attempt after five seconds:<\/p><pre class=\"wp-block-preformatted\">scp -o \"ConnectionAttempts=2\" -o=\"ConnectTimeout=5\" \/users\/scp.zip root@162.168.1.2<\/pre><p>This won&rsquo;t change the configuration file when passing the SSH settings, as it will apply only to your current SCP session. To learn more about the full keys and their values, refer to the SSH_config manual.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Discover Other Linux Commands for Server Management<\/h4>\n                    <p><br>\n<a href=\"\/uk\/tutorials\/vps\/how-to-check-and-manage-disk-space-via-terminal\">How to Check Disk Space on Linux<\/a><br>\n<a href=\"\/uk\/tutorials\/curl-command-with-examples-linux\/\">How to Transfer Data With Curl Command<\/a><br>\n<a href=\"\/uk\/tutorials\/linux-time-command\/\">How to Calculate Process Execution With Time Command<\/a><br>\n<a href=\"\/uk\/tutorials\/linux-watch-command\/\">How to Monitor Changes With Watch Command<\/a><br>\n<a href=\"\/uk\/tutorials\/linux-shutdown-command\/\">How to Shutdown and Restart the Server<\/a><br>\n<a href=\"\/uk\/tutorials\/how-to-use-rsync\">How to Transfer and Synchronize Data With Rsync<\/a><br>\n<a href=\"\/uk\/tutorials\/how-to-kill-a-process-in-linux\">How to Kill a Process in Linux<\/a><br>\n<a href=\"\/uk\/tutorials\/linux-tee-command-with-examples\/\">The Tee Command for Efficient File Writing<\/a><\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>The Linux SCP command enables secure file copying between systems through encrypted SSH, offering a more efficient and safer alternative to FTP. Its syntax involves options, system addresses, file location, and target path, with address and directory omission for local transfers. <\/p><p>SCP not only allows file transfers between local and remote systems but also between two remote systems via a local machine. Options like -P and -C customize the transfer process. <\/p><p>Hostinger users can benefit from our AI assistant, Kodee, for easy SCP command generation and a Browser terminal for executing remote server commands via web browsers.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-scp-command-for-file-transfer-faq\">How to Use SCP Command for File Transfer FAQ<\/h2><p>In this section, we will answer several questions about the SCP command in Linux.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1641636934180\"><h3 class=\"schema-faq-question\">How Do I Run SCP on Windows?<\/h3> <p class=\"schema-faq-answer\">You can run SCP on Windows using PuTTY&rsquo;s PSCP command-line utility, which comes pre-installed with the SSH client. To use the command utility, open the Windows PowerShell <a href=\"\/uk\/tutorials\/what-is-cli\">command line interface<\/a>. It has a similar syntax to SCP but starts with <strong>pscp -scp<\/strong>.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1641636984527\"><h3 class=\"schema-faq-question\">Can I Pass Password in SCP Command?<\/h3> <p class=\"schema-faq-answer\">Yes. You can pass a password with SCP in Linux using the <strong>sshpass <\/strong>command utility with the <strong>-p<\/strong> option or <strong>pscp<\/strong> with the <strong>-pw<\/strong> option for Windows. Add your SSH password after both options. The rest of the syntax stays the same as a regular SCP command.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1641637050526\"><h3 class=\"schema-faq-question\">How Do I Stop or Pause SCP?<\/h3> <p class=\"schema-faq-answer\">Pause a process by passing the <strong>terminal stop <\/strong>signal (SIGTSTP) using the <strong>Ctrl+Z <\/strong>shortcut. To resume the process, send the SIGCONT signal by typing <strong>fg<\/strong>. If SIGCONT doesn&rsquo;t work, use the <a href=\"\/uk\/tutorials\/how-to-use-rsync\">rsync utility<\/a> to check whether content disparities exist between the systems and copy only the files missing in the target directory<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Secure copy protocol (SCP) is a command that enables efficient and secure file transfers between two systems over a network. It uses Secure Shell (SSH) to authenticate the systems and encrypt your data. The SCP command streamlines data transfer between Linux systems since administrators don&rsquo;t need to log in to both servers. In addition, it [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/uk\/tutorials\/linux-scp-command\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Use the SCP Command to Transfer Files in Linux","rank_math_description":"The SCP command allows a secure and easy way to transfer files to a remote host, such as a VPS server. Check our article to learn how to use it.","rank_math_focus_keyword":"scp command","footnotes":""},"categories":[22644,22640],"tags":[],"class_list":["post-15545","post","type-post","status-publish","format-standard","hentry","category-managing-monitoring-and-security","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/linux-scp-command","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/como-usar-comando-scp-linux","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/comment-utiliser-la-commande-scp-linux","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/comando-scp","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/scp-linux","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/linux-scp-command","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/linux-scp-command","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/linux-scp-command","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/comando-scp","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/comando-scp","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/comando-scp","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/como-usar-comando-scp-linux","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/linux-scp-command","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/linux-scp-command","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/linux-scp-command","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/linux-scp-command","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/15545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/comments?post=15545"}],"version-history":[{"count":28,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/15545\/revisions"}],"predecessor-version":[{"id":117106,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/15545\/revisions\/117106"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/media?parent=15545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/categories?post=15545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/tags?post=15545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}