Cut and Paste - Windows vs Linux

Everyone pretty much knows that in Windows you highlight what you want to copy with your mouse, hit Ctrl-c to copy then Ctrl-v to paste. Although this is great, it’s even easier in Linux!

In Linux, you highlight what you want to copy with your mouse, and then just middle click on you mouse to paste. No need to use the keyboard.

There might be a few exceptions to this, like you’ll need to use Ctrl-v for pasting your password into the Steam client.

I realized watching a video Jason posted yesterday that some people weren’t aware of this, thus the post. :slight_smile:

5 Likes

Another thing.

To paste something into (most) terminal emulators, you can use CTRL+SHIFT+V.

7 Likes

Neat , however if you’re used to ctrl+c, ctrl+v I’m not sure there’d actually be any time saved doing it this way.

Sure there is, if you need to one-hand it for some reason.

I quite often use the ctrl+shift+v etc, especially when in the command line. Having to move my hand to the mouse just to cut and paste takes longer.

I totally prefer the keyboard.

But yes, middle click is cool, too.

1 Like

I know this is an old thread, but I just had to add a bit of explanation to this:

XWindows has a PRIMARY selection and a CLIPBOARD selection.

PRIMARY is the text that is “selected” on the screen. Only one application can own the PRIMARY selection at any given time. If you select in another window, the selection in the first window disappears. Once you’ve selected text, it goes into the PRIMARY selection. If you click somewhere and release the selection, the contents of PRIMARY are still available to middle-click as long as nothing else has been selected, as that would replace the contents of PRIMARY again.

If you press Ctrl-C, the currently selected text is copied to CLIPBOARD. (It also ends up in PRIMARY, because you had to select something to copy.)

When you middle-click, X is taking PRIMARY and pasting it wherever you middle click. This does not affect the CLIPBOARD.

If the PRIMARY selection is empty when you middle-click, X will paste the contents of the CLIPBOARD.

When you press Ctrl-V, X will paste the CLIPBOARD selection to where your cursor is.

You can select something, copy it, select something else, then alternate between Ctrl-V and middle-click to see that your CLIPBOARD is unmodified.

I’ve also left out the parts relating to things other than text in a CLIPBOARD. (Images, files, etc)

(Also, when I say XWindows and X above, I probably mean the X client (the application), not the X server, as it’s probably the X client that is implementing the copy/paste logic. This means that everything above could be different for non-compliant applications. There is also a SECONDARY selection, but I haven’t seen where this is used. The selections are in CAPS because this is how it is defined in the X11 Protocol.)

1 Like

While you are correct this is true . . . I hate middle click pasting. It gets in the way often and is more annoying to me than useful.

3 Likes

Well, I’ve rarely ran Windows full time since really NT, so ya. I kinda got used to using the middle mouse button for pasting. :wink:

I use the middle click for so many things that most of the time the middle click paste is just a nuisance to me. For example, I have custom settings for my desktop to use a different menu on middle click, middle click to open links and pasting urls is infuriating when I just want to click a link. :smiley:

And don’t forget to mention, shift+ctrl+c copies from the terminal, too.

I personally like the middle mouse click and use it quite often.
However if you don’t want it you could take a look at XMousePasteBlock.

I’m special so I’m still using CTRL/SHIFT + INSERT :turtle:

Started doing in “back in the day” on Windows cause CTRL + C/V was blocked in some programs.

1 Like

This is so neat!!! I never knew this existed! This works in the terminal as well as in the GUI apps. Thank you for sharing. I think I just found my new favorite shortcut.

Can someone braver than I am please test this in VIM and emacs? (I’m afraid I can never find the ‘exit’ so I don’t install or use them. :stuck_out_tongue: )

You can interact with the clipboard in Vim using the + register, and the primary selection with the * register, assuming that X11 support is compiled in (installing GVim or Neovim should take care of this.) Pasting the contents of your clipboard is accomplished with "+p, and yanking a line into PRIMARY is done with "*yy.

Emacs’ kill ring automatically syncs with the system clipboard, so you can use normal Emacs kill and yank commands to interact with it. Again, this assumes that you have the X11 version installed.

For future reference, you can exit Vim with :q! (think i quit !) or Emacs with C-x C-c (come up with your own mnemonic device, I’m all out of ideas!)

1 Like

Thats awesome! I’ve been stuck on Nano for the past few years because Vim and Emacs were just too complicated for me to pick up and use. I really wish that we had an editor like the one that came with DOS 6.22. (It was basic, but had a menu structure and was perfect in its simplicity.)

2 Likes

If you want to get into the world of extensible text editors, I would heartily recommend Neovim. Just fire it up and run :Tutor to get started. After you get used to things, @brokenbyte in the Discord server has some tips for customization, assuming you want to get into that.