268

How to execute a copy paste operation from Windows 10 to the Bash on Ubuntu on Windows environment?

I tried the following:

  • ctrl + shift + v
  • right click to paste

Any suggestions?

oddRaven
  • 672
  • 1
  • 7
  • 20
Ghassan Zein
  • 4,089
  • 3
  • 19
  • 30
  • 3
    I updated the question so you can understand it.. it's about the NEW ubuntu bash on windows. – Ghassan Zein Aug 08 '16 at 15:39
  • 1
    What is your terminal? – glenn jackman Aug 08 '16 at 17:04
  • 11
    Guys you are missing something: Windows Anniversary 10 Update has a new ubuntu bash integrated with it, so please read about it and then you'll understand the question. My terminal IS UBUNTU BASH ON WINDOWS! – Ghassan Zein Aug 09 '16 at 11:03
  • See also the issue: [Keyboard shortcuts for copy / paste into console](https://github.com/Microsoft/BashOnWindows/issues/235) on the Microsoft/BashOnWindows repository. – Evandro Coan Jul 18 '17 at 05:22
  • 3
    This should be re-opened. From [the Bash on Ubuntu on Windows 'about' page](https://msdn.microsoft.com/en-us/commandline/wsl/about) [emphasis mine]: "Bash on Windows provides **developers** with a familiar Bash shell and Linux environment ...". – Kenny Evitt Jul 21 '17 at 14:15
  • 1
    [As-of the Windows "Creators Update"](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13661418-add-a-way-to-copy-to-windows-clipboard-from-the-lx) you should be able to copy to the clipboard by piping to `clip.exe`, e.g. `echo "Blah blah blah" | clip.exe`. – Kenny Evitt Jul 21 '17 at 14:16
  • 1
    After experimenting, ctrl+shift+c to copy and ctrl+shift+p to paste works for me. I'd post this as an answer but the question is closed. – Evan Rosica Oct 16 '17 at 07:43
  • What happened when you tried it? E.g. was there an error message? – Peter Mortensen Jul 05 '18 at 09:05

13 Answers13

212

Update 2019/04/16: It seems copy/paste is now officially supported in Windows build >= 17643. Take a look at Rich Turner's answer. This can be enabled through the same settings menu described below by clicking the checkbox next to "Use Ctrl+Shift+C/V as Copy/Paste".


Another solution would be to enable "QuickEdit Mode" and then you can paste by right-clicking in the terminal.

To enable QuickEdit Mode, right-click on the toolbar (or simply click on the icon in the upper left corner), select Properties, and in the Options tab, click the checkbox next to QuickEdit Mode.

With this mode enabled, you can also copy text in the terminal by clicking and dragging. Once a selection is made, you can press Enter or right-click to copy.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
chipit24
  • 6,509
  • 7
  • 47
  • 67
  • 3
    I didn't realise that right-clicking did the paste right away... I was expecting to see a context menu pop up with options. – RSmithlal May 06 '17 at 17:07
  • 3
    After using left mouse button to select text, I have to **right click twice** to get the text to paste. – Felipe Alvarez May 29 '17 at 04:49
  • 4
    Yes.. mouse click works.. is there a way to do this with keyboard only (selection and paste)? that is the point of using VIM/UBUNTU/Shell after all. – alpha_989 Jul 24 '17 at 13:37
  • 5
    So no way to paste with the keyboard? – qwertzguy Aug 25 '17 at 04:16
  • 3
    @FelipeAlvarez You only have to right click once to paste. The first time you right click you are copying the text; please read the answer more carefully. It's been a while since I used Bash on Ubuntu on Windows, but did not find a way to enable copy/paste with the keyboard. – chipit24 Oct 16 '17 at 17:31
  • Warning: This will cause programs to hang while scrolling text on the screen if you click on them, until you press enter to continue. See https://stackoverflow.com/questions/30418886/how-and-why-does-quickedit-mode-in-command-prompt-freeze-applications – mltsy Feb 23 '18 at 23:19
58

To get right-click to paste to work:

  • Right-click on the title bar > Properties
  • Options tab > Edit options > enable QuickEdit Mode

enter image description here

chipit24
  • 6,509
  • 7
  • 47
  • 67
jaredlt
  • 703
  • 4
  • 12
  • 1
    Can you clarify what is the insert mode? – alpha_989 Jul 24 '17 at 13:37
  • 1
    @alpha_989 Insert Mode inserts text at the cursor (and pushes subsequent characters to the right), rather than overwrite characters to the right of the cursor. Insert Mode is the default mode most people expect. From testing it doesn't seem like this setting is respected in WSL. I have it unchecked but it still inserts rather than overwrites. – jaredlt Jul 24 '17 at 15:08
48

At long last, we're excited to announce that we FINALLY implemented copy and paste support for Linux/WSL instances in Windows Console via CTRL + SHIFT + [C|V]!

You can enable/disable this feature in case you find a keyboard collision with a command-line app, but this should start working when you install and run any Win10 builds >= 17643. Select "Properties" from the menu to access the following dialog box.

New Console Properties showing CTRL + SHIFT + C/V option

Thanks for your patience while we re-engineered Console's internals to allow this feature to work :)

Nagev
  • 10,835
  • 4
  • 58
  • 69
Rich Turner
  • 10,800
  • 1
  • 51
  • 68
  • 1
    How do I check my current build version and force an update if I do not see this – Jacob Goulden May 03 '18 at 15:28
  • 2
    To find your current Windows version, run `winver` from the run dialog or command-line. To get early access to these and other features as they're being built, you'll need to sign up for the Windows Insider Program; details here: https://insider.windows.com/en-us/ – Rich Turner May 04 '18 at 01:28
  • @RichTurner thanks for this - I knew the feature existed but found it *really hard* to see the minimum version number attached to it. Looks like I'll need to upgrade to get access :) – Ian Clark May 20 '18 at 07:02
  • Blog post starts with "As of Windows 10 Insider build #17643" ;) – Rich Turner May 21 '18 at 20:47
  • Could not find this option in the latest Ubuntu App of Windows 10 1803. – Nafeez Abrar Sep 19 '18 at 07:30
  • 1
    @NafeezAbrar - Blog post starts with "As of Windows 10 Insider build #17643" - 1803 was build 17682. This feature will ship in builds >= 17643, leading up to general release in Windows 10 Fall 2018 Update. – Rich Turner Sep 20 '18 at 17:35
  • @RichTurner I have updated to 1809 today. It works fine. – Nafeez Abrar Dec 03 '18 at 11:41
  • 1
    @Nafeez Abrar: Good to hear. Thanks for letting us know :) – Rich Turner Dec 04 '18 at 21:08
  • I installed Ubuntu bash on a recent Windows build (19042 > 17643) and I had to manually tick the box. The copy paste shortcut is still *not* the default. – Nagev Mar 27 '21 at 16:06
  • Making this option the default would break too many apps which use CTRL + SHIFT + C/V for other purposes. Also, we STRONGLY encourage you to use Windows Terminal rather than the legacy Console. – Rich Turner Mar 30 '21 at 00:54
  • Thanks, just installed Windows Terminal and it looks good, but it's a PowerShell rather than a Linux environment; for example `uname` returns an error. Which is why I use the Ubuntu Terminal mentioned in this post, don't know if that is what you're calling a "legacy console". There's a "Use legacy console" checkbox but I always leave that unticked (the default). – Nagev Jun 17 '21 at 16:02
  • 1
    Ah, you can select Ubuntu on Windows Terminal. Totally missed that, should be an answer! – Nagev Jun 17 '21 at 16:06
21

Right-click the title bar, select context menu Edit -> Paste (until they fix the control key shortcuts)

林果皞
  • 7,539
  • 3
  • 55
  • 70
cryogenyx
  • 211
  • 1
  • 5
  • 1
    This is temporary a good solution, but weird how do they release it without the simplest features.. – Ghassan Zein Aug 10 '16 at 08:36
  • 2
    until when exactly? it's january 2018 and they did not fix the control key shortcuts yet. this is in creators update. – Paul Vixie Jan 05 '18 at 09:49
  • Apparently, newer builds of Windows 10 became available to the general public later in 2018, or early 2019. But the update didn't happen automatically. Go into Settings, Windows Update, and click on Check for Updates. – MarkHu Apr 09 '19 at 01:25
18

You can use AutoHotkey (third party application), the command below is good with plain alphanumeric text, however some other characters like =^"%#! are mistyped in console like bash or cmd. (In any non-console window this command works fine with all characters.)

^+v::SendRaw %clipboard%
  • I tried using `^#v` as `Ctrl+Shift+V`, but it did not work because `^#v` stands for `Ctrl+WinKey+V`. You should use `^+v`, which stands for `Ctrl+Shift+V`. – Evandro Coan Jul 18 '17 at 05:25
  • Although it requires a third party program, that seems to be normal to make Windows usable anyway. I think this is the best answer because it allows you to retain the keyboard shortcut you're used to – Erin Drummond Jan 03 '18 at 07:03
  • 1
    I am using `+Ins` because `^+v` collides with any program already using that for other purposes in some contexts like nano "jump to last line". I have yet to find anything using shift+insert for different purposes. – chx Jan 22 '18 at 15:40
  • 7
    And for those who want it to paste instantly rather than one character at a time: `^+v::SendInput %clipboard%` – Jeremy Bernier Jun 21 '18 at 05:18
  • Works strange, replaces `/` chart to `|` so paths `/a/b/c` turns into `|a|b|c` – Doctor Coder Mar 11 '19 at 07:31
  • A similar way to copy? – BND Sep 25 '19 at 19:18
  • For Auto Hot Key users (like me) this is great, thanks! I didn't like how slow it pasted, and @JeremyBernier's suggestion for `SendInput` is better, but still a little slower than a real Shif+Insert. So I made an AHK script that only does `SendInput %clipboard%` for ubuntu.exe, and for everything else does `SendInput {shift down}{insert}{shift up}` to keep other apps pasting at normal speed: https://gist.github.com/myerspliers/89bc7f9257b659ac239e2911ebad5e9e – Matthew Mar 18 '20 at 23:17
12

As others have said, there is now an option for Ctrl+Shf+Vfor paste in Windows 10 Insider build #17643.

Unfortunately this isn't in my muscle memory and as a user of TTY terminals I'd like to use Shf+Ins as I do on all the Linux boxes I connect to.

This is possible on Windows 10 if you install ConEmu which wraps the terminal in a new GUI and allows Shf+Ins for paste. It also allows you to tweak the behaviour in the Properties.

The Console looks like this:ConEmu Console

Copy options:ConEmu Copy properties

Paste options:ConEmu Paste properties

Shf+Ins works out of the box. I can't remember if you need to configure bash as one of the shells it uses but if you do, here is the task properties to add it:ConEmu Bash Task Properties

Also allows tabbed Consoles (including different types, cmd.exe, powershell etc). I've been using this since early Windows 7 and in those days it made the command line on Windows usable!

Stuart Brock
  • 3,596
  • 1
  • 22
  • 21
  • 2
    Although this solution is a pretty heavy-handed one for a feature that really should be integrated into Windows Bash (and will be soon with build 17643?), it gave me `Shift+Ins` for paste without even messing with the settings. Plus, I am excited to check out the app for what else it offers. – Craig Silver Aug 12 '18 at 16:48
  • 1
    Thanks for the comment. From what I can tell `Shf+Ins` is not going to be available in build 17643 - Just `Shf+Ctrl+V`. I use `Shf+Ins` every day so didn't want to learn an alternative key press. – Stuart Brock Aug 13 '18 at 14:18
  • 1
    Thanks for this, I've been missing my shf+Ins since I dumped cygwin in favor of WSL. And I really like this application for mor than just that. – low351 May 08 '19 at 17:16
  • [mintty](https://github.com/mintty/wsltty) is a much more lightweight option that allows for shift/ctrl+insert copying and pasting – liltitus27 Sep 27 '20 at 14:52
10

Like it has been written before:

  • Right Click on Bash on Ubuntu on Windows Icon if you have it on a Task Bar Shortcut Icon
  • Click on Properties
  • Select Options Tab on the Properties Window
  • Check the QuickEditMode option
  • Click Apply

Now you are able to open a new Bash Terminal and just use Right-Click to paste

In order to be able to copy from Terminal, Just use CTRL+M and this will enable you to select and copy selected Text.

Ilhicas
  • 1,429
  • 1
  • 19
  • 26
4

For pasting into Vim in the terminal (bash on ubuntu on windows):

export DISPLAY=localhost:0.0

Not sure how to copy from Vim though :-(

Jon49
  • 4,444
  • 4
  • 36
  • 73
  • 2
    `DISPLAY` has absolutely nothing to do with `vim` or copy and pasting. – Felipe Alvarez May 29 '17 at 04:48
  • @FelipeAlvarez Apparently it worked for me. Let me know if you come up with a better solution! – Jon49 May 29 '17 at 17:44
  • @Jon49, Can you explain what this is doing? Are you putting this in .vimrc? or within vim like :export DISPLAY=localhost:0.0 – alpha_989 Jul 24 '17 at 14:55
  • @alpha_989, That goes into the Ubuntu terminal. I believe it connects Ubuntu and Windows somehow. Been a while so I don't remember all the details. – Jon49 Jul 24 '17 at 20:25
3

Alternate solution over here, my windows home version Windows Subsystem Linux terminal doesn't have the property to use Shift+Ctrl (C|V)

Use an actual linux terminal![enter image description here]1

  • Install an X-server in Windows (like X-Ming)
  • sudo apt install <your_favorite_terminal>
  • export DISPLAY=:0
  • fire your terminal app, I tested with xfce4-terminal and gnome-terminal

windows #ubuntu #development

Gubatron
  • 6,222
  • 5
  • 35
  • 37
2

For just copying (possibly long) texts to the Windows clipboard, I have found that just piping the output to clip.exe (including the .exe file extension) works fine for me. So:

$ echo "Hello World" | clip.exe

lets me paste Hello World using Ctrl-V anywhere else.

Now that I have posted this, I notice that related question Pipe from clipboard in linux subsytem for windows includes this and a command solution for pasting from the Windows clipboard as well.

ojdo
  • 8,280
  • 5
  • 37
  • 60
1

you might have bash but it is still a windows window manager. Highlite some text in the bash terminal window. Right click on the title bar, select "Edit", select "Copy", Now Right Click again on the Title bar, select "Edit" , Select "Paste", Done. You should be able to Highlite text, hit "Enter" then Control V but this seems to be broken

Colin MacKenzie - III
  • 1,373
  • 12
  • 13
0

For autohotkey users, a full answer is:

#IfWinActive ahk_class ConsoleWindowClass
^+v::SendInput %clipboard%

Which checks that you're in a console (windows or ubuntu) before pasting from the windows clipboard.

oldpedro
  • 29
  • 1
-1

That turned out to be pretty simple. I've got it occasionally. To paste a text you simply need to right mouse button click anywhere in terminal window.

verymax
  • 1
  • 1