Copy Paste in Bash on Ubuntu on Windows
Solution 1
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.
Solution 2
To get right-click to paste to work:
- Right-click on the title bar > Properties
- Options tab > Edit options > enable
QuickEdit Mode
Solution 3
Ok, it's developed finally and now you are able to use Ctrl+Shift+C/V to Copy/Paste as of Windows 10 Insider build #17643.
You'll need to enable the "Use Ctrl+Shift+C/V as Copy/Paste" option in the Console "Options" properties page:
(source: windows.net)
referenced in blogs.msdn.microsoft.com/
Solution 4
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.
Thanks for your patience while we re-engineered Console's internals to allow this feature to work :)
Solution 5
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%
Related videos on Youtube
Ghassan Zein
I'm a senior system administrator who is always focusing on Open Source Technologies.
Updated on March 20, 2022Comments
-
Ghassan Zein about 2 years
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?
-
Ghassan Zein over 7 yearsI updated the question so you can understand it.. it's about the NEW ubuntu bash on windows.
-
glenn jackman over 7 yearsWhat is your terminal?
-
Ghassan Zein over 7 yearsGuys 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!
-
user almost 7 yearsSee also the issue: Keyboard shortcuts for copy / paste into console on the Microsoft/BashOnWindows repository.
-
Kenny Evitt almost 7 yearsThis should be re-opened. From the Bash on Ubuntu on Windows 'about' page [emphasis mine]: "Bash on Windows provides developers with a familiar Bash shell and Linux environment ...".
-
Kenny Evitt almost 7 yearsAs-of the Windows "Creators Update" you should be able to copy to the clipboard by piping to
clip.exe
, e.g.echo "Blah blah blah" | clip.exe
. -
Evan Rosica over 6 yearsAfter 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.
-
Peter Mortensen almost 6 yearsWhat happened when you tried it? E.g. was there an error message?
-
Ghassan Zein over 7 yearsThis is temporary a good solution, but weird how do they release it without the simplest features..
-
RSmithlal almost 7 yearsI didn't realise that right-clicking did the paste right away... I was expecting to see a context menu pop up with options.
-
Felipe Alvarez almost 7 years
DISPLAY
has absolutely nothing to do withvim
or copy and pasting. -
Felipe Alvarez almost 7 yearsAfter using left mouse button to select text, I have to right click twice to get the text to paste.
-
Jon49 almost 7 years@FelipeAlvarez Apparently it worked for me. Let me know if you come up with a better solution!
-
user almost 7 yearsI tried using
^#v
asCtrl+Shift+V
, but it did not work because^#v
stands forCtrl+WinKey+V
. You should use^+v
, which stands forCtrl+Shift+V
. -
alpha_989 almost 7 yearsYes.. 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 almost 7 yearsCan you clarify what is the insert mode?
-
alpha_989 almost 7 years@Jon49, Can you explain what this is doing? Are you putting this in .vimrc? or within vim like :export DISPLAY=localhost:0.0
-
jaredlt almost 7 years@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.
-
Jon49 almost 7 years@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.
-
qwertzguy over 6 yearsSo no way to paste with the keyboard?
-
chipit24 over 6 years@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.
-
Erin Drummond over 6 yearsAlthough 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
-
Paul Vixie over 6 yearsuntil when exactly? it's january 2018 and they did not fix the control key shortcuts yet. this is in creators update.
-
chx over 6 yearsI 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. -
mltsy about 6 yearsWarning: This will cause programs to hang while scrolling text on the screen if you click on them, until you press enter to continue. See stackoverflow.com/questions/30418886/…
-
Jacob Goulden almost 6 yearsHow do I check my current build version and force an update if I do not see this
-
Rich Turner almost 6 yearsTo 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: insider.windows.com/en-us -
Ian Clark almost 6 years@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 :)
-
Rich Turner almost 6 yearsBlog post starts with "As of Windows 10 Insider build #17643" ;)
-
Jeremy Bernier almost 6 yearsAnd for those who want it to paste instantly rather than one character at a time:
^+v::SendInput %clipboard%
-
methodsignature almost 6 years2018 here, don't see this in production (full windows 10 with ubuntu from the app store). sigh.
-
Todd Freed almost 6 yearsHow do you know what Windows build you're on? I don't see this option.
-
αғsнιη almost 6 yearstype in Run/Start,
winver
@methodsignature -
Hippyjim almost 6 yearsNope. Does nothing.
-
Craig Silver over 5 yearsAlthough 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. -
Stuart Brock over 5 yearsThanks for the comment. From what I can tell
Shf+Ins
is not going to be available in build 17643 - JustShf+Ctrl+V
. I useShf+Ins
every day so didn't want to learn an alternative key press. -
Nafeez Abrar over 5 yearsCould not find this option in the latest Ubuntu App of Windows 10 1803.
-
Rich Turner over 5 yearsAs per the blog post above, this first shipped in Win10 Insider build 17643, and will be included in the Fall 2018 Update shipping "soon"™ ;)
-
Rich Turner over 5 years@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.
-
Steve Goossens over 5 yearsWhat you describe as broken sounds like you don't have Quick Edit mode enabled in the console settings
-
Nafeez Abrar over 5 years@methodsignature Found this feature in Windows 10 (1809). Try to update your windows now.
-
Nafeez Abrar over 5 years@RichTurner I have updated to 1809 today. It works fine.
-
Rich Turner over 5 years@Nafeez Abrar: Good to hear. Thanks for letting us know :)
-
Doctor Coder about 5 yearsWorks strange, replaces
/
chart to|
so paths/a/b/c
turns into|a|b|c
-
MarkHu about 5 yearsApparently, 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.
-
low351 almost 5 yearsThanks 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.
-
BND over 4 yearsA similar way to copy?
-
BND over 4 yearsHow to make this the default setting, I notice I have to do that every time I open a new terminal.
-
αғsнιη over 4 yearsHi @BND currently I'm not a Windows user and don't know why it's not keeping the changes; maybe you can run it 'as administrator' and do change and see if it's can keep or you will need to modify in registery
regedit
(but again dono the registry key); opening a question would be your another choice as well -
Matthew about 4 yearsFor 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 doesSendInput %clipboard%
for ubuntu.exe, and for everything else doesSendInput {shift down}{insert}{shift up}
to keep other apps pasting at normal speed: gist.github.com/myerspliers/89bc7f9257b659ac239e2911ebad5e9e -
liltitus27 over 3 yearsmintty is a much more lightweight option that allows for shift/ctrl+insert copying and pasting
-
Nagev about 3 yearsI 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.
-
Rich Turner about 3 yearsMaking 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.
-
Nagev almost 3 yearsThanks, 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 almost 3 yearsAh, you can select Ubuntu on Windows Terminal. Totally missed that, should be an answer!