1

I am using ConEmu terminal to access files in the Linux distro of my Windows 10 machine. I open text files with Nano or VIM, but I am having trouble copying entire text files back to Windows.

Obviously selecting the texts with the mouse and copying, then going back to Windows and pasting works fine. However when the file has hundreds of lines this does not work.

In Nano, I have tried things like turning on soft wrap (Esc+$) and making the font size small before copying. It is not desirable for super large files.

In VIM I tried to install VIM-GNOME then yanked the texts with %y+ but this buffer cannot be copied back into Windows.

I could try to locate the Linux file inside Windows Explorer then opening with a Windows text editor but this is a bit inconvenient and dangerous.

How can I copy the content of an entire file (or a large chunk of it) and pasting from Linux Subsystem to Windows?

I am using ConEmu terminal but if there is a solution with another terminal I would like to try also.

Thanks!

1 Answers1

2

Moving large files through the clipboard is, as you have discovered, a somewhat awkward experience. You're better off copying the entire file.

I could try to locate the Linux file inside Windows Explorer then opening with a Windows text editor but this is a bit inconvenient and dangerous.

There are two right ways and one wrong way to do this.

The first method is to use WSL to copy the file into a Windows directory. This means anything under a /mnt/<driveletter> mountpoint. For example, /mnt/c/Users/Your.Username/Documents would map to your Windows Documents folder. This is entirely safe - though you may need a text editor capable of reading LF line endings to open the file correctly.

Alternatively, if you are using Windows 10 v1903 or newer, you can safely access WSL directories and files via the wsl$ share. The easiest way is to open the WSL directory via explorer, by running explorer.exe . within WSL.

The dangerous method involves accessing the WSL directories via AppData. Do not do this.

Bob
  • 63,170