27

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.

bioShark
  • 4,251
  • 1
    On Ubuntu you can use the middle mouse button (clicking with the wheel) for that – Wayne_Yux Feb 14 '16 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 '16 at 21:32
  • Made a small edit to my answer, check it out. – Sergiy Kolodyazhnyy Feb 20 '16 at 00:01
  • Is Right Click -> Paste really too hard? :/ – Seth Feb 20 '16 at 03: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 '16 at 08:20
  • @banskt you may want to add that as an answer, with details of whete to get the patch, how to apply it, etc – Sergiy Kolodyazhnyy Feb 20 '16 at 12:10
  • @Serg Added the answer below, but it is downvoted. Anyway, a patch seems to be the only option, given gnome terminal does not allow this feature by any settings control. – banskt Feb 20 '16 at 13:41
  • @banskt Yes, that's second best alternative aside from using X servers selection or putty itself. Your answer is well written and hence has my upvote. Keep up the good work ! – Sergiy Kolodyazhnyy Feb 20 '16 at 14:14
  • For many mice, the middle mouse button is the wheel. I would rather not use it to click because it slips easily. – landau Nov 15 '17 at 12:12

4 Answers4

38

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.

Stunts
  • 2,182
  • 1
  • 16
  • 27
8

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.

banskt
  • 359
  • 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 '16 at 08:02
  • 1
    Mar 2019: Din't work, new to ubuntu (again), see 1. Error :: You must put some 'source' URIs in your sources.list https://askubuntu.com/a/857433/330608 2. original source http://www.taika.org/~tomba/gnome-terminal/index.html 3. *-paste.patch file is now missing, stuck here, can't proceed. – Manohar Reddy Poreddy Mar 20 '19 at 23:59
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.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • 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 '16 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. – Sergiy Kolodyazhnyy Feb 19 '16 at 23:01
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
    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. –  Feb 15 '16 at 05:11