Copying file to linux from windows

Copy Files Between Windows and Linux Using Command Line

In this updated guide, I will walk you through the steps to copy files from Windows to Linux using easy-to-follow steps.

I will show you two ways to copy files from windows to Linux

  1. Using command line with pscp
  2. Using GUI FTP utility.

Copy File from Windows To Linux Using PSCP

It is not always that you will need to copy a file from Windows to Linux or vice versa.

But at times when you are automating things or trying to achieve some copy functionality using a script, it is good to have a utility to do that.

Here is where pscp comes into play. Using pscp you can copy the file to/from windows and Linux.

Step 1: Download pscp.exe from here. Select the appropriate package.

Step 2: copy the pscp.exe executable to the system32 directory of your windows machine. This folder normally exists in C:\Windows\System32 path.

Step 3: Open Windows PowerShell and use the following command to verify if pscp is accessible from the path.

You should see the following output.

Step 4: Use the following format to copy the single file from Windows to the Linux box.

Here is the explanation of the command.

  1. -pw for the password.
  2. Replace password with the Linux user password.
  3. C:\Users\Admin\Desktop\test.txt represents the path of the file that has to be copied to the Linux system.
  4. 192.168.33.10 is the IP of the Linux server.
  5. /home/vagrant is the user-accessible path in the Linux system to copy the file.

If you want to copy all the files in a directory to Linux, you need to add a start to the folder. eg. folder\* . An example is shown below.

If you are using Linux private keys for authentication, you can use -i flag instead of -pw followed by the path to the .ppk , .pem or id_rsa file.

If your key file is in pem format, you can use the puttygen command to convert it to ppk. See this ec2 server guide for the pem to ppk conversion.

Info: Learn Linux & Windows administration from Pluralsight with its 10 days free account

For Linux Private key-based authentication, the command looks like below.

Copy File From Linux To Windows Using PSCP

You can use pscp to copy files from Linux to windows. use the following command format for the same.

The above command will copy the file in Linux from the specified path to the Windows desktop.

Copy File from Windows To Linux Using FTP GUI

If you are not familiar with the Windows command line, you can use an FTP tool like Filezilla.

Читайте также:  Что такое неофициальная сборка windows

This tool is really helpful if you are working with Web Hosting providers to upload your website files from your local workstation.

You can download Filezilla from here –> FileZilla Download.

After download, install Filzill as you install any other windows software.

After installation, open the Filezilla app and enter the remote Linux server details as shown below. It will connect to the server and shows the remote server files in the file explorer.

To upload a file, all you have to do is do a right-click and click upload, as shown in the image below. The file will get uploaded to the remote path, which is opened in the Filezilla explorer. You can also change the remote path from Filezilla.

Conclusion

I have shown two best and recommended ways to transfer files from Windows to Linux and vice versa.

If you face any issues while copying files, please drop the issues as a comment. I will look into it.

Источник

2 Ways to Copy Files from Windows 10 to Windows Sub-System for Linux

Today we are going to discuss about how to copy file from your Windows 10 machine to Windows Sub-System for Linux.

Distribution Package of Windows Sub-System for Linux

First thing first, before you can even begin you have to understand where all the Linux files are placed in your Windows 10 machine. To avoid any accidental tampering Microsoft stores all you Linux files under the following hidden folder:

Here you can find your Linux distribution packages (distro) , double-click on the folder for your distribution, following is name of distribution package and folder name mapping:

Distribution Package Folder Name
Ubuntu CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
openSUSE Leap 42 46932SUSE.openSUSELeap42.2_022rs5jcyhyac
SUSE Linux Enterprise Server 12 46932SUSE.SUSELinuxEnterpriseServer12SP2_022rs5jcyhyac

For Ubuntu which I’m using, I’ll look for CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc and then navigate to folder navigate to .\LocalState\rootfs\ folder. This is the root file share where all you files are placed

Copy Files

Method 1 – Manual Copy-Paste

You can simply move or copy-paste files inside one of these Linux directories,

but the files won’t appear in you Windows Sub-system for Linux Bash Shell until you restart it.

Method 2 – Windows System Drive as a Mount point

Windows Sub-System for Linux provides you access to the Windows 10 system drive by mounting the C:\ . On Linux if you go to you root directory and list all directories, then you will notice a /mnt/c/ which is Windows 10 C:\ mounted on Linux

Now simply use copy command ( cp ) to copy files over to your Linux Subsystem.

Video Tutorial

If you like this article read more similar articles under ‘N – Ways to’ category

My New Book : PowerShell Scripting Guide to Python

This PowerShell Scripting guide to Python is designed to make readers familiar with syntax, semantics and core concepts of Python language, in an approach that readers can totally relate with the concepts of PowerShell already in their arsenal, to learn Python fast and effectively, such that it sticks with readers for longer time.

“Use what you know to learn what you don’t. ” also known as Associative learning.

Book follows a comparative method to jump start readers journey in Python, but who is the target audience? and who should read this book –

  • Any System Administrator who want to step into Development or Programming roles, and even if you don’t want to be a developer, knowledge of another scripting language will make your skill set more robust.
  • Python Developers who want to learn PowerShell scripting and understand its ease of user and importance to manage any platform.

Python is one of the top programming languages and in fast changing IT scenarios to DevOps and Cloudto the future – Data Science, Artificial Intelligence (AI) and Machine Learning Python is a must know.

But this PowerShell Scripting guide to Python would be very helpful for you if you already have some knowledge of PowerShell

NOTE! This is a Leanpub “Agile-published” book. That means the book is currently unfinished and in-progress. As I continue to complete the chapters, we will re-publish the book with the new and updated content. Readers will receive an email once a new version is published!

While the book is in progress, please review it and send any feedback or error corrections at [email protected]

Follow @SinghPrateik

Источник

Как скопировать или переместить файлы из Windows в Linux

Зачем отказываться от использования одной операционной системы? Сегодня на один компьютер можно установить две и более операционных системы. И хотя мы можем сделать это несколькими способами (виртуальные машины, Windows подсистемы и т. д.), способ воспользоваться преимуществами 100% операционной системы — это физически установить ее на ПК благодаря двойной загрузке или двойной загрузке. Однако, когда мы переключаемся с одной системы на другую, мы можем столкнуться с некоторыми проблемами. Особенно при попытке получить доступ к нашим файлам из Windows и Linux.

Каждая операционная система использует свою файловую систему. Windows, например, использует NTFS на его основном разделе; macOS использует собственную систему, НПФ ; и Linux, хотя он совместим с большим количеством файловых систем, в большинстве дистрибутивов наиболее часто используется EXT4 . Поскольку каждая система использует свои собственные форматы, доступ к разделам других операционных систем затруднен (и опасен). Итак, если мы используем Linux и нам нужно получить доступ к файлу, сохраненному на жестком диске Windows, что мы можем сделать?

Сохраняйте данные на общем жестком диске

Если мы хотим избежать проблем такого типа, лучшее, что мы можем сделать, это создать общий диск, на котором мы сможем сохранять данные всех операционных систем, которые мы используем. Этим устройством может быть жесткий диск или раздел, который у нас есть внутри нашего ПК, или внешний жесткий диск, который мы подключили к ПК. Важно то, что на этом диске файловая система совместима как с Windows, так и с Linux. И хотя мы можем использовать для этого NTFS, лучшее, что мы можем выбрать, чтобы избежать проблем, — это ExFAT .

И Windows, и Linux смогут читать и записывать на диск exFAT. без проблем. Эта файловая система представляет собой улучшенную версию FAT32, в которой, среди прочего, устранено ограничение в 4 ГБ на файл. Следовательно, мы можем использовать его как связующее звено между всеми нашими операционными системами. Важно убедиться, что мы храним все данные там.

Еще одна альтернатива, которую мы можем использование — это сервер NAS . Эти серверы подключены к сети и позволяют любому подключенному к ней пользователю получать доступ к данным. Обычно они монтируют сервер SMB / SAMBA, поэтому файлы будут доступны как в Windows, так и в Linux.

Другие способы доступа к данным Windows из Linux

В этом случае мы посмотрим, что мы можем сделать, если нам понадобится доступ к файлу из Linux, который мы сохранили на жестком диске Windows.

Перезагрузите компьютер

Самый простой и в то же время безопасный — это перезагрузите компьютер и вернитесь в Windows . Таким образом, мы снова получим доступ ко всем файлам, которые мы сохранили на этом жестком диске, и, следовательно, сможем получить к нему доступ. Теперь, когда мы находимся в Windows, мы можем выбрать, делать ли то, что мы хотели, из Microsoft операционной системы, или передать файл в Linux, либо через флешку, либо с жесткого диска nexus, что мы объяснили в предыдущем пункте.

Это самый безопасный способ сделать это, поскольку, не заходя на жесткий диск Windows из Linux, мы избегаем изменения разрешений или повреждения файлов, что избавляет нас от проблем. Однако это самый медленный метод.

Смонтируйте жесткий диск NTFS

Linux способен чтение и запись на диски NTFS. Само ядро ​​имеет собственный контроллер, и для этого есть другие сторонние инструменты. Чтение файлов из раздела NTFS из Linux обычно работает нормально, обычно не вызывает проблем. Но если мы собираемся внести какие-либо изменения, мы рискуем, что что-то пойдет не так и некоторые данные будут повреждены. Windows может быть повреждена, или мы можем потерять файлы.

Если мы знаем, что собираемся делать, мы можем смонтировать NTFS-диск Windows и получить доступ ко всем его данным. Пока мы ничего не трогаем и не изменяем, мы можем копировать (да, лучше копировать, чем перемещать) файл или файлы, которые нам нужны, с этого устройства в раздел Linux, и, таким образом, мы можем работать с ними без проблем.

Это самый быстрый способ, но и самый рискованный. И это будет возможно только в том случае, если у нас нет диска, зашифрованного с помощью Bitlocker.

Восстановить данные Linux из Windows

Что, если мы используем Linux, мы возвращаемся в Windows и забыли файл? Здесь у нас есть несколько способов повторно получить доступ к данным.

Перезагрузите компьютер

Как и в предыдущем случае, самый безопасный и простой способ — это перезагрузите компьютер и снова войдите в Linux . Оказавшись там, мы можем скопировать файл на флешку или внешний жесткий диск и снова перезапустить, чтобы перенести его в Linux. Это самый долгий и утомительный процесс, но он и самый безопасный.

Используйте программу для чтения EXT4

Windows по умолчанию не может читать или записывать на диски Linux EXT. Следовательно, если мы хотим получить доступ к данным, необходимо установить программу, которая позволяет нам это делать. Существует очень разнообразное программное обеспечение, как бесплатное, так и платное, которое позволяет нам это делать. Однако большинство из них — это довольно устаревшие программы, которые, хотя и могут работать, но также могут выдавать ошибки.

Если мы не собираемся писать в этих модулях и хотим только передавать данные, мы можем прибегнуть к этим программам. Если нет, лучше найти другую альтернативу.

Используйте подсистему Windows для Linux

Microsoft очень сильно делает ставку на интеграцию Linux в Windows. Благодаря Подсистема Windows для Linux , WSL, можно загрузить полный экземпляр Linux поверх операционной системы благодаря Hyper-V. С появлением WSL2 Windows может монтировать и использовать диски Linux EXT4, как если бы это был жесткий диск, более подключенный к компьютеру.

Если мы опытные пользователи, у которых включен WSL в Windows, и мы хотим получить доступ к данным Linux из операционной системы Microsoft, это лучший вариант. В любом случае, мы надеемся, что Microsoft скоро упростит этот процесс, добавив почти встроенную поддержку EXT4 из Windows.

Источник

Читайте также:  Новое железо без переустановки windows
Оцените статью