Copy Paste in Bash on Ubuntu on Windows

后端 未结 13 1622
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 09:32

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

I tried the following:

  • ctrl + shift
相关标签:
13条回答
  • 2020-12-07 09:36

    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:

    Copy options:

    Paste options:

    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:

    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!

    0 讨论(0)
  • 2020-12-07 09:40

    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.

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

    0 讨论(0)
  • 2020-12-07 09:42

    To get right-click to paste to work:

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

    0 讨论(0)
  • 2020-12-07 09:42

    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 :-(

    0 讨论(0)
  • 2020-12-07 09:43

    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.

    0 讨论(0)
  • 2020-12-07 09:49

    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

    0 讨论(0)
提交回复
热议问题