Enable direct copy and paste in Windows 10 Bash Shell
Windows 10's Bash Shell finally has some handy keyboard shortcuts for copying and pasting. But they are disabled by default for compatibility reasons. These shortcuts are already available in the Insider Preview builds of Redstone 5, which will be released in Fall 2018.
Enable shortcuts in Windows 10
To enable copy and paste keyboard shortcuts, right-click the title bar of the Linux bash shell window and then select the "Properties" command. With Redstone 5's Set feature enabled, you need to right-click an empty part of the title bar, not a tab.
Check the "Use Ctrl + Shift + C / V as copy / paste" option. Then click the "OK" button.
You can now press Ctrl + Shift + C to copy the selected text to the Bash shell. And Ctrl + Shift + V to paste from clipboard to shell.
Since this feature uses the standard operating system clipboard, you can copy and paste to and from other Windows desktop applications. You can even use the new clipboard history feature by pressing Windows + V.
Windows remembers this setting, but only for the current connection. So if you started an Ubuntu shell from a shortcut on the taskbar. The keyboard shortcuts will automatically be enabled when you launch Ubuntu from that shortcut on the taskbar one more time.
However, if you boot Ubuntu from a Start menu shortcut or boot another Linux distribution from a different shortcut. The Bash shell window will open with keyboard shortcuts disabled. You can enable keyboard shortcuts for the new window and that setting will be remembered for any shortcuts you launched.
The shortcuts are versatile
This new option is actually part of the Windows console environment. Not just from the Windows subsystem for Linux. This means you can enable these shortcuts for other console environments as well, like Command Prompt and PowerShell. However, you can already copy and paste into those apps with the standard Ctrl + C and Ctrl + V shortcuts thanks to the "Enable Ctrl Keyboard Shortcuts" option.
The "Enable Ctrl Keyboard Shortcuts" option is enabled by default. But it doesn't work in the Linux Bash shell environment. This is because Ctrl + C sends a break signal. Which tells the ongoing process to terminate. Ctrl + V performs a "literal insert", which causes the next key combination you press to be entered instead of being processed by the terminal. These new keyboard shortcuts provide a functional alternative.
Leave a Reply