Copy paste linux windows

Copy Paste in Bash on Ubuntu on Windows

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!

This 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 . «.

As-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 .

13 Answers 13

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.

I didn’t realise that right-clicking did the paste right away. I was expecting to see a context menu pop up with options.

After using left mouse button to select text, I have to right click twice to get the text to paste.

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.

@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.

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

@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.

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 ]!

Читайте также:  Kali linux raspberry pi 400

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 🙂

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: insider.windows.com/en-us

@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.

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

until when exactly? it’s january 2018 and they did not fix the control key shortcuts yet. this is in creators update.

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.

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.)

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 .

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

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.

And for those who want it to paste instantly rather than one character at a time: ^+v::SendInput %clipboard%

As others have said, there is now an option for Ctrl+Shf+V for 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.

ConEmu Console

The Console looks like this:

ConEmu Bash Task 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:

Читайте также:  Quake 3 arena сервер linux

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!

Источник

Copy and Paste arrives for Linux/WSL Consoles

As of Windows 10 Insider build #17643, you can copy/paste text from/to Linux/WSL Consoles. We know that this is a feature MANY of you have been waiting for – our sincerest thanks for your patience & continued support while we untangled the Console’s internals, allowing us to implement this feature. To ensure that we don’t break any existing behaviors, you’ll need to enable the “Use Ctrl+Shift+C/V as Copy/Paste” option in the Console “Options” properties page: With the new copy & paste option selected, you’ll be able to copy and paste text using [CTRL] + [SHIFT] + [C|V] respectively.

Note: This setting can be set independently for each shell or shortcut: If you pin your shortcuts to your favorite shells (e.g. Cmd/PowerShell/Linux) to your task bar, and modify the properties of Consoles launched via these shortcuts, your settings will only be made to the affected shortcuts. If you later launch the same shell via the Start menu, or the run dialog, your settings will not be found as they’ll have been saved to your pinned shortcuts, not your Start menu tiles/shortcuts, or registry settings. Please let us know how you get on with this feature If you find any issues, please lookup/post issues on our GitHub issues repo. If you have other feature asks, please find & upvote, or post them on our UserVoice

Rich Turner Sr. Program Manager, Windows Console & Command-Line

For many years, Windows Notepad only supported text documents containing Windows End of Line (EOL) characters — Carriage Return (CR) & Line Feed (LF). This means that.

6 comments

Just finding WSL, which has been a life-saver for me on a current project. Does seem odd to have to retrain myself to add the shift-key for cut and past after so many years and so many programs using ctrl-x and ctrl-v. Are we going to get there eventually, or is this the way it is?

I would very much doubt it. The [control-shift] sequences are how linux consoles operate. Further, overwriting the ctrl-c ctrl-x ctrl-v sequences with copy/cut/paste would break some of the more fundamental aspects of linux shells, because ctrl-[thing] is how you send signals to the running application. Particularly colliding here is ctrl-c, which sends the “SIGINT” signal to the running application, basically telling it “I don’t care what you’re doing, exit now please”.

Hi
What about ctrl+ins / shift+ins?
Thats what i use in windows for decades and miss the most in wsl In linux i use a lot select mouse to copy and RMB to paste. What do you think of that? Thank yoh

Читайте также:  How to open file in linux terminal

Источник

How can one copy text from nano in Ubuntu WSL2 and paste it into a Windows application?

Microsoft has made this nifty tool called Windows Subsystem for Linux. WSL2 creates a lightweight VM running Linux (in this case Ubuntu) to facilitate using Linux on Windows. Within WSL2 (Ubuntu) I’ve run: sudo nano ~/.ssh/id_rsa.pub . I attempt to use the normal nano method for copying. I can’t then paste it on the Windows side. Ends up WSL2 has its own key combination for copying/pasting between Linux/Windows and that you need to enable it within WSL. I enable the function within WSL and use Ctrl+Shift+C to copy the text as instructed. Ctrl+Shift+V into a windows app does nothing. I use the regular nano method to copy (Alt+Shift+A to mark, arrow keys to select, Alt+Shift+6 to copy) and then paste using Ctrl+Shift+V into a Windows app, still no luck. What am I missing?

4 Answers 4

The usual way is selecting the text with the mouse and right click for copy.

You can also use clip.exe to copy all the content of a linux file to Windows Clipboard.

cat ~/.ssh/id_rsa.pub | clip.exe 

Select the text with the left mouse button and press once on the right mouse button to copy on the Windows clipboard.
Now you can paste the copied text in WSL with another right button click, or paste in Windows with CTRL-V .
So when you want to copy/paste in WSL, you press the buttons left (select the text with the mouse), right, right .

Edit: Part beneath was a comment:
In Nano first change the layout to soft wrapping (soft: don’t insert real new lines) . Nano help explains: Meta-key sequences are notated with ‘M-‘ and can be entered using either the Alt, Cmd, or Esc key, depending on your keyboard setup. and M-$ Soft wrapping of overlong lines enable/disable. With my keyboard layout ($ above the 4) this results in ALT-SHIFT-4. Now the long lines are wrapped and visible in the screen.

What if the text is one long line and runs off the visible screen? For example, an SSH key opened in nano? In this case the mouse cursor will not cause nano to move right so the entire string can be selected.

In Nano first change the layout to soft wrapping (soft: don’t insert real new lines) . Nano help explains: Meta-key sequences are notated with ‘M-‘ and can be entered using either the Alt, Cmd, or Esc key, depending on your keyboard setup. and M-$ Soft wrapping of overlong lines enable/disable . With my keyboard layout ($ above the 4) this results in ALT-SHIFT-4. Now the long lines are wrapped and visible in the screen.

The soft-wrapping makes this answer work; perhaps put it on your main answer? How ridiculous is it though that you have to point and click to copy on a CLI program.

Источник

Оцените статью
Adblock
detector