{"id":68136,"date":"2022-10-25T09:03:25","date_gmt":"2022-10-25T09:03:25","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=68136"},"modified":"2022-10-25T09:03:25","modified_gmt":"2022-10-25T09:03:25","slug":"transfer-files-and-folders-from-windows-to-linux-with-pscp","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=68136","title":{"rendered":"Transfer files and folders from Windows to Linux with PSCP"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">Transfer files and folders from Windows to Linux with PSCP<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/plaubscher\" class=\"username\">Paul<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Tue, 10\/25\/2022 &#8211; 03:00<\/span><\/p>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>Are you looking for a way to quickly transfer files from your Windows computer to your Linux computer and back again? The open source PSCP utility makes it easy to transfer files and folders, and of course it&#8217;s open source.<\/p>\n<h2>Setting your PATH in Windows<\/h2>\n<p>Knowing how to set your command path in Windows makes it easier to use a handy utility like PSCP. If you&#8217;re unfamiliar with that process, read <a href=\"https:\/\/opensource.com\/article\/22\/10\/set-path-powershell\" target=\"_blank\" rel=\"noopener\">how to set a PATH on Windows<\/a>.<\/p>\n<h2>Using PSCP<\/h2>\n<p>PSCP (PuTTY Secure Copy Protocol) is a command-line tool for transferring files and folders from a Windows computer to a Linux computer.<\/p>\n<ol>\n<li>\n<p>Download <code>pscp.exe<\/code> from its <a href=\"https:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/latest.html\">website<\/a>.<\/p>\n<\/li>\n<li>\n<p>Move <code>pscp.exe<\/code> to a folder in your PATH (for example, <code>DesktopApp<\/code> if you followed the PATH tutorial here on <a href=\"http:\/\/opensource.com\/\">Opensource.com<\/a>). If you haven&#8217;t set a PATH variable for yourself, you can alternately move <code>pscp.exe<\/code> to the folder holding the files you&#8217;re going to transfer.<\/p>\n<\/li>\n<li>\n<p>Open Powershell on your Windows computer using the search bar in the Windows taskbar (type &#8216;powershell` into the search bar.)<\/p>\n<\/li>\n<li>\n<p>Type <code>pscp \u2013version<\/code> to confirm that your computer can find the command.<\/p>\n<\/li>\n<\/ol>\n<h2>IP address<\/h2>\n<p>Before you can make the transfer, you must know the IP address or fully-qualified domain name of the destination computer. Assuming it&#8217;s a computer on your same network, and that you&#8217;re not running a DNS server to resolve computer names, you can find the destination IP address using the <code>ip<\/code> command on the Linux machine:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"br0\">[<\/span>linux<span class=\"br0\">]<\/span>$ <span class=\"kw2\">ip addr<\/span> show <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"st_h\">'inet '<\/span><br>\ninet 127.0.0.1<span class=\"sy0\">\/<\/span><span class=\"nu0\">8<\/span> scope host lo<br>\ninet 192.168.1.23<span class=\"sy0\">\/<\/span><span class=\"nu0\">24<\/span> brd 10.0.1.255 scope global noprefixroute eth0<\/div><\/div><\/pre>\n<p>In all cases, 127.0.0.1 is a loopback address that the computer uses only to talk to itself, so in this example the correct address is 192.168.1.23. On your system, the IP address is likely to be different. If you&#8217;re not sure which is which, you can try each one in succession until you get the right one (and then write it down somewhere!)<\/p>\n<p>Alternately, you can look in the settings of your router, which lists all addresses assigned over DHCP.<\/p>\n<h2>Firewalls and servers<\/h2>\n<p>The <code>pscp<\/code> command uses the OpenSSH protocol, so your Linux computer must be running the OpenSSH server software, and its firewall must allow SSH traffic.<\/p>\n<p>If you&#8217;re not sure whether your Linux machine is running SSH, then run this command on the Linux machine:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"br0\">[<\/span>linux<span class=\"br0\">]<\/span>$ <span class=\"kw2\">sudo<\/span> systemctl <span class=\"kw3\">enable<\/span> <span class=\"re5\">--now<\/span> sshd<\/div><\/div><\/pre>\n<p>To ensure your firewall allows SSH traffic, run this command:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"br0\">[<\/span>linux<span class=\"br0\">]<\/span>$ <span class=\"kw2\">sudo<\/span> firewall-cmd <span class=\"re5\">--add-service<\/span> <span class=\"kw2\">ssh<\/span> <span class=\"re5\">--permanent<\/span><\/div><\/div><\/pre>\n<p>For more information on firewalls on Linux, read <a href=\"https:\/\/opensource.com\/article\/19\/7\/make-linux-stronger-firewalls\">Make Linux stronger with firewalls<\/a>.<\/p>\n<h2>Transfer the file<\/h2>\n<p>In this example, I have a file called <code>pscp-test.txt<\/code> that I want to transfer from <code>C:UserspaulDocuments<\/code> on my Windows computer to my destination Linux computer home directory <code>\/_home_\/paul<\/code>.<\/p>\n<p>Now that you have the <code>pscp<\/code> command and the destination address, you&#8217;re ready to transfer the test file <code>pscp-test.txt<\/code>. Open Powershell and use the <code>dir<\/code> command to change to the <code>Documents<\/code> folder, where the sample file is located:<\/p>\n<p>PS&gt; dir %USERPROFILE%Documents<\/p>\n<p>Now execute the transfer:<br \/>\n\u00a0<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">PS<span class=\"sy0\">&gt;<\/span> pscp pscp-test.txt paul<span class=\"sy0\">@<\/span>192.168.1.23:<span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>paul<br><span class=\"sy0\">|<\/span> Password:<br>\nEnd of keyboard-interactive prompts from server<br>\npscp-test.txt <span class=\"sy0\">|<\/span> <span class=\"nu0\">0<\/span> kb <span class=\"sy0\">|<\/span> <span class=\"nu0\">0.0<\/span> kB<span class=\"sy0\">\/<\/span>s <span class=\"sy0\">|<\/span> ETA: 00:00:00 <span class=\"sy0\">|<\/span> <span class=\"nu0\">100<\/span><span class=\"sy0\">%<\/span><\/div><\/div><\/pre>\n<p>Here&#8217;s the syntax, word for word:<\/p>\n<ul>\n<li>\n<p><code>pscp<\/code>: The command used to transfer the file.<\/p>\n<\/li>\n<li>\n<p><code>pscp-test.txt<\/code> is the name of the file you want to transfer from Windows.<\/p>\n<\/li>\n<li>\n<p><code>paul@192.168.1.23<\/code> is my username on the Linux computer, and the IP address of the Linux computer. You must replace this with your own user and destination information. Notice that <code>pscp<\/code> requires a destination path on the target computer, and <code>:\/home\/paul<\/code> at the end of the IP address specifies that I want the file copied to my home folder.<\/p>\n<\/li>\n<\/ul>\n<p>After you authenticate to the Linux computer, the <code>pscp-test.txt<\/code> file is transferred to the Linux computer.<\/p>\n<p><strong>[ Related read\u00a0<a href=\"https:\/\/opensource.com\/article\/21\/4\/share-files-linux-windows\" target=\"_blank\" rel=\"noopener\">Share files between Linux and Windows computers<\/a> ]<\/strong><\/p>\n<h2>Verifying the transferred<\/h2>\n<p>On your Linux computer, open a terminal and use the <code>ls<\/code> command to verify that the file <code>pscp-test.txt<\/code> appears in your home directory.<br \/>\n\u00a0<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"br0\">[<\/span>linux<span class=\"br0\">]<\/span>$ <span class=\"kw2\">ls<\/span><br>\nDocuments<br>\nDownloads<br>\nMusic<br>\nPictures<br>\npscp-test.txt<\/div><\/div><\/pre>\n<\/p>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">More Linux resources<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/linux-commands-cheat-sheet\/?intcmp=70160000000h1jYAAQ\">Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/advanced-linux-commands\/?intcmp=70160000000h1jYAAQ\">Advanced Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/rh024-red-hat-linux-technical-overview?intcmp=70160000000h1jYAAQ\">Free online course: RHEL technical overview<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-networking?intcmp=70160000000h1jYAAQ\">Linux networking cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-selinux?intcmp=70160000000h1jYAAQ\">SELinux cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/linux-common-commands-cheat-sheet?intcmp=70160000000h1jYAAQ\">Linux common commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/resources\/what-are-linux-containers?intcmp=70160000000h1jYAAQ\">What are Linux containers?<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux?intcmp=70160000000h1jYAAQ\">Our latest Linux articles<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<h2>Copying a file off of a Linux system<\/h2>\n<p>You aren&#8217;t limited to just copying files to your Linux system. With <code>pscp<\/code>, you can also copy a file from Linux onto Windows. The syntax is the same, only in reverse:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\">PS<span class=\"sy0\">&gt;<\/span> pscp paul<span class=\"sy0\">@<\/span>192.168.1.23:<span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>paul<span class=\"sy0\">\/<\/span>pscp-test.txt <span class=\"sy0\">%<\/span>USERPROFILE<span class=\"sy0\">%<\/span>Documentspscp-win.txt<\/code><\/span><\/pre>\n<p>Here&#8217;s the syntax:<\/p>\n<ul>\n<li>\n<p><code>pscp<\/code>: The command used to transfer the file.<\/p>\n<\/li>\n<li>\n<p><code>paul@192.168.1.23:\/home\/paul\/pscp-test.txt<\/code> is my username on the Linux computer, the IP address of the Linux computer, and the path to the file I want to copy.<\/p>\n<\/li>\n<li>\n<p><code>%USERPROFILE%Documents<\/code> is the location on my Windows computer where I want to save the file. Notice that in copying the file back to my Windows computer, I can give it a new name, such as <code>pscp-win.txt<\/code>, to differentiate it from the original. You don&#8217;t have to rename the file, of course, but for this demonstration it&#8217;s a useful shortcut.<\/p>\n<\/li>\n<\/ul>\n<p>Open your file manager to verify that the <code>pscp-win.txt<\/code> file was copied to the Windows <code>C:UserspaulDocuments<\/code> path from the Linux computer.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/10\/Filemanager.pscp_.png\" width=\"640\" height=\"337\" alt=\"Image of a file manager.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Paul Laubscher, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<h2>Remote copying<\/h2>\n<p>With the power of the open source <code>pscp<\/code> command, you have access to any computer in your house, and servers you have accounts on, and even mobile and <a href=\"https:\/\/opensource.com\/tags\/edge-computing\" target=\"_blank\" rel=\"noopener\">edge devices<\/a>.<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>The open source PSCP utility makes it easy to transfer files and folders between Windows and Linux computers.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/10\/browser_screen_windows_files.png\" width=\"1040\" height=\"585\" alt=\"Computer screen with files or windows open\" title=\"Computer screen with files or windows open\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>Opensource.com<\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux\" hreflang=\"en\">Linux<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/windows\" hreflang=\"en\">Windows<\/a><\/div>\n<\/p><\/div>\n<div class=\"hidden field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/10\/cc-by-sa--27.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Transfer files and folders from Windows to Linux with PSCP Paul Tue, 10\/25\/2022 &#8211; 03:00 Are you looking for a way to quickly transfer files from your Windows computer to your Linux computer and back again? The open source PSCP utility makes it easy to transfer files and folders, and of course it&#8217;s open source. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":68137,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-68136","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/68136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68136"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/68136\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/68137"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}