Ubuntu – How to one copy text from nano in Ubuntu WSL2 and paste it into a Windows application

copy and pastenanotext-editorwindowswindows-subsystem-for-linux

Microsoft has made this nifty tool called Windows Subsystem for Linux. WSL2 creates a lightweight VM running Linux (in this case Ubuntu) to facilitate using Linux on Windows.

Within WSL2 (Ubuntu) I've run: sudo nano ~/.ssh/id_rsa.pub. I attempt to use the normal nano method for copying. I can't then paste it on the Windows side.

Ends up WSL2 has its own key combination for copying/pasting between Linux/Windows and that you need to enable it within WSL.

I enable the function within WSL and use Ctrl+Shift+C to copy the text as instructed. Ctrl+Shift+V into a windows app does nothing.

I use the regular nano method to copy (Alt+Shift+A to mark, arrow keys to select, Alt+Shift+6 to copy) and then paste using Ctrl+Shift+V into a Windows app, still no luck.

What am I missing?

Best Answer

The usual way is selecting the text with the mouse and right click for copy.

You can also use clip.exe to copy all the content of a linux file to Windows Clipboard.

cat ~/.ssh/id_rsa.pub | clip.exe
Related Question