WSL terminal's keyboard paste is not working

In Ubuntu WSL2 in Windows 10 (Pro 20H2 19042.1237) I cannot paste text to the terminal using the keyboard (Ctrl+V), despite the fact that I activated the property in Preferences:

enter image description here

Does anyone know how to fix it?


Solution 1:

Short answer

The image you provided shows that you enabled CtrlShiftC and CtrlShiftV for Copy/Paste.

This is not the same as CtrlC and CtrlV.

Windows Console Host (the terminal you are using) does not allow using CtrlC/CtrlV for Copy/Paste in WSL. I would suggest upgrading to Windows Terminal (available in the Microsoft Store). This is the Microsoft developed replacement for Windows Console that is installed by default in Windows 11.

The default behavior for new users in Windows Terminal is to enable CtrlC/CtrlV for Copy/Paste. However, I would recommend against this as Linux shells already expect to handle CtrlV themselves, and letting the Terminal do it will break some Linux/shell functionality (see below).

See this answer for a more in-depth discussion of these keys and how they are handled by the Terminal vs. the Shell.

More detail

A few notes:

  • The terminal that you are referring to is known as the "Windows Console Host", and it is the "legacy" terminal that has been in Windows for more than 20 years now.

    Windows Console Host does not handle CtrlC/CtrlV. While you can use those keys in CMD (in the same Terminal app), that's because the CMD shell handles those keys for Copy/Paste.

  • Microsoft has released a replacement called "Windows Terminal" that is greatly improved, with numerous new features, including the ability to use CtrlC/CtrlV for Copy/Paste.

    It is available to install from the Microsoft Store in Windows 10 (or 11), but is also installed by default in Windows 11. With a (currently) Preview release, you can set it as the default terminal in Windows 11.

    It is open source and under active development with (currently) frequent new releases.

  • Note that CtrlV is used by Bash and other shells to insert special characters (verbatim entry mode). I would recommend keeping the behavior of that key-chord as-is to avoid breaking this feature personally, but plenty of others make the decision to override it.