6

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?

2 Answers 2

6

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.

3
  • 2
    Thanks a lot! Indeed I missed "Shift" in Ctrl+Shift+V. And thank you for your recommendation: Windows Terminal is really very convenient
    – Renat
    Commented Oct 9, 2021 at 16:35
  • Why does C:\Windows\System32\wsl.exe run a 20 year old "Windows Console Host" when WSL itself isn't anywhere near that old?
    – Michael
    Commented Aug 16, 2022 at 15:59
  • 1
    @Michael Sorry, missed that question until just today. When WSL was launched 7 years ago (now), Windows Terminal still didn't exist, so WSL just did the same thing that PowerShell, CMD, Python, and every other Windows console application did and let Windows decide how to launch it. When Windows used the Console Host, WSL (and everything else) used the Console Host. Now that Windows 11 uses Windows Terminal as the default, WSL (and everything else) launches in Windows Terminal. Commented Feb 27, 2023 at 12:48
1

You have enabled paste using Ctrl+Shift+V.

This is perhaps why Ctrl+V is not working.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .