Mouse button Copy & Paste on Ubuntu 20.04

Using the left mouse button to select and copy text in terminals and the middle mouse button to paste has been a feature of X-Windows, and the various window managers built on top of X-Windows, since the early 1990s. With the release of Ubuntu 20.04 and Gnome 3.36 Canonical has removed this convention, forcing a more awkward and slower select, right click, select Copy from a menu, point, right click, select Paste from menu to do the same thing.

If you want to restore select-to-copy, middle button to paste functionality to Ubuntu 20.04 just follow these steps.

Restore select-to-copy functionality

Edit the file .Xresources in your home directory.

Add the line:

xterm*selectToClipboard: true

… to the file, then logout of your desktop and log back in, or reboot.

Once you’ve done that any text that you select in the Terminal program with your left mouse button will be copied to your clipboard. Left click a word and the word is copied to the clipboard. Left click and drag to select and copy an entire line, an entire paragraph, or more.

Restore middle-button paste functionality

Install gnome-tweaks:

sudo apt-get install gnome-tweaks

Click “Activities” in the upper right and search for “tweaks”, click the “Tweaks” icon.

Select “Keyboard & Mouse” and turn “Middle Click Paste” to “on”.

Once you’ve done that, clicking the middle mouse button will paste text from your clipboard back into the terminal.

Hope you find this useful.

10 thoughts on “Mouse button Copy & Paste on Ubuntu 20.04

  1. Thank you so, much, Earl Ruby!
    I loved the middle mouse button click paste. Only an Insane Clown Posse would have taken that out of the default Ubuntu Installation.

    Bill (Alexey Karamazov) Moore

    • Sure! and that Insane Clown Posse is still alive: the problem persists in Ubuntu 22.04 “Jammy”. I’ve tried using gnome-tweak to solve it. No success so far…

  2. sir
    i try to make copy or paste files directly in ubuntu 20.04. but it is not possible. kindly help me

    • I’m running Ubuntu 20.04 now and it works just fine. I got it working by doing the steps in the above article. What happens when you try the steps listed in the article?

      • The steps above is for enabling copy-n-pasting *text*. The post you were replying was for copy and pasting *files*.

  3. Today, on an Ubuntu 20.04 desktop configured as described above, I noticed if I selected text in Firefox I could paste that into my terminal with the middle mouse button, but if I selected text in the terminal itself that text was not copied into the buffer and could not be pasted using the middle mouse button.
    I exited the terminal program and restarted it. Problem solved. Select to copy, middle mouse button to paste was working again.

  4. * yes, totally unbelievable that this marvelous 3-buttoms click & copy is not working by default in U22.04

    * unfortunately this trick described here is not working for me, maybe because I am using XFCE ?

    Thanks. A.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.