24

At work I'm using putty to connect to a lot of Red Hat / CentOS machines and I love the fact that selecting a text means copy and right click means paste.

Can I set Ubuntu's default terminal to do the same?

Edit: Thanks for the answers, but they are not exactly what I am looking for. While both are valid, I was actually looking for a way to use the functionality without using another terminal. So everything should work via the default gnome terminal.

I am not sure it's possible, but I'll try my luck and start a bounty on this...

Edit: Thank you guys for your answers and sorry for the late reply but I was out over the week-end. I'll check the "selection/middle mouse button" solution tonight and come back to you.

The patch solution sounds also promising.

9
  • On Ubuntu you can use the middle mouse button (clicking with the wheel) for that
    – Wayne_Yux
    Feb 14, 2016 at 19:58
  • I think the answer by Stunts is exactly the answer to this question. If you believe it's not, then could you edit your question to provide more details as to what exactly you need. @Wayne_Yux comment is the same as Stunts answer
    – Felipe
    Feb 19, 2016 at 21:32
  • Made a small edit to my answer, check it out. Feb 20, 2016 at 0:01
  • Is Right Click -> Paste really too hard? :/
    – Seth
    Feb 20, 2016 at 3:23
  • A guy called Tomi Valkeinen uses a patch on gnome-terminal to get the functionality you are looking for. Checked it out myself, and it works perfectly.
    – banskt
    Feb 20, 2016 at 8:20

4 Answers 4

35
+50

In gnome-terminal (and in Ubuntu in general) select text means "copy" (or "X selection" if you want to get technical, which is different from "clipboard copy"), which can be pasted via middle mouse click.

3
  • Thanks for your answer, it was actually what I was looking for :). As @Serg has pointed out, you have the best answer.
    – bioShark
    Feb 22, 2016 at 18:23
  • You've got to love these solutions which only involve moving a finger by 1/4 inch Apr 15, 2019 at 13:17
  • 6
    This answer is useful, however it's actually not answering the question "how to paste with right click".
    – msoutopico
    Oct 16, 2019 at 14:02
7

Let me expand on my original answer a little bit. Technically, the default terminal emulator, the gnome-terminal does not have this functionality and there's no way to set it as far as I know or have seen from researching online. Therefore the answer to your question

Can I set Ubuntu's default terminal to do the same?

is basically, no.

On the other hand, putty is actually also available for Ubuntu, and that is the simplest , least-effort solution if you want a specific behavior. Do sudo apt-get install putty to get it.

There is however a few compromises that you can adopt, and they exist the way they are for historical reasons. The graphical environment under Unix/Linux X server has something known as selections, think of them as multiple clipboards - primary, secondary, and "clipboard". The second selection is when you highlight text and use ShiftInsert or middle mouse click to paste. Middle mouse click is scroll wheel click on mouses, and on touchpads - right and left click pressed together.

There are solutions with other terminals but since you request gnome-terminal specifically, the answer still remains , no, there's no other way.

2
  • He's asking if the Ubuntu default terminal can do the same. I'm guessing to work locally and not to connect to all those red-hat servers.
    – Felipe
    Feb 19, 2016 at 21:33
  • @Felipe Gnome terminal , which is the default, cannot do that. Putty itself is a simplest, minimum-effort solution. Gnome terminal has paste shortcut and highlight-copy with middle mouse click, but since op wants a specific , not similar behavior, putty is the next best solution on the list. Feb 19, 2016 at 23:01
7

I found this patch by Tomi Valkeinen: Gnome-terminal patch for putty-like right mouse button paste

Let us know if it works for you.

Edit: I went ahead and checked it myself. It works perfectly. Here are the patched deb files for gnome-terminal-3.6.2: uploaded in mediafire

If you are using the same version of gnome-terminal, you can download the deb files and install it by:

cd /path/to/download/folder
sudo dpkg -i gnome-terminal_3.6.2-0ubuntu1_amd64.deb gnome-terminal-data_3.6.2-0ubuntu1_all.deb

Edit: For future reference, here is the full procedure:

Download the patch: right-button-paste.patch

Install build dependencies:

sudo apt-get build-dep gnome-terminal

Download the sources and apply the patch:

mkdir gnome-terminal
cd gnome-terminal
sudo apt-get source gnome-terminal
cd gnome-terminal-*
patch -p1 < path/to/right-button-paste.patch

Build and install:

sudo dpkg-buildpackage -us -uc -b
cd ..
dpkg -i *.deb

Up to date patches are maintained by Tomi Valkeinen at https://github.com/tomba/gnome-terminal under 'paste-*' branches.

2
  • After the negative vote, I went ahead and installed the patch myself. It works perfectly and right-click-paste works on the default gnome-terminal.
    – banskt
    Feb 20, 2016 at 8:02
  • 1
    Mar 2019: Din't work, new to ubuntu (again), see 1. Error :: You must put some 'source' URIs in your sources.list askubuntu.com/a/857433/330608 2. original source taika.org/~tomba/gnome-terminal/index.html 3. *-paste.patch file is now missing, stuck here, can't proceed. Mar 20, 2019 at 23:59
0

Solution for this is to use Terminator, an Linux terminal: Terminator

Also here is a tutorial how to do this: Right click paste on linux terminal with terminator

1
  • 1
    While a link to the tutorial is nice, we like to limit the amount of outbound traffic required for our users. Please edit your answer to include a short description of the process on your link and provide the link as a source.
    – user323419
    Feb 15, 2016 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.