I want to make gnome-terminal behave in such a way that when the end user selects a region on the terminal (with a mouse or mouse key), it gets automatically copied into the clipboard. Is it possible at all? If so, how?
-
2That's the default behavior for me... – Pascal Thivent Jul 27 '10 at 23:38
-
1mmmkey. im getting the feeling that this is not possible under gnome-terminal (unlike putty). if so, i'll just need to add half a dozen lines to selection_changed_callback in terminal-window.c, i suppose. if anybody thinks otherwise, please post your answer here; o.w. i'll just add changes to gnome-terminal source and rebuild it. – OTZ Jul 28 '10 at 00:11
-
1On my Fedora 23, with gnome terminal 3.18.3
+Selection for line or – statquant Jul 16 '16 at 12:40+ +Selection to "copy". Once this is done you can use + to insert IN ANOTHER terminal or the middle click everywhere else.
10 Answers
it's possible.
sudo apt-get install parcellite
then in the settings check "use primary" and "synchronize clipboards". it works.

- 2,951
- 1
- 31
- 39
-
9
-
16@qdii while that's true, it gets people going in a worthwhile direction. "yum install parcellite" works for fedora etc., and no this still doesn't cover every linux flavor. Here is the offical project for everyone else: [link]http://parcellite.sourceforge.net/ – redreinard Feb 27 '13 at 22:49
-
Steps for CentOS 6.6 found [on the "Install Howto" section on this site](http://pkgs.org/centos-6/repoforge-x86_64/parcellite-0.9-1.el6.rf.x86_64.rpm.html) – jtooker May 28 '15 at 14:10
-
7Note that "synchronize clipboards" setting in Parcellite will overwrite your clipboard every time you select something in a text editor (Sublime Text in my case), even if you use keyboard to make the selection. So I don't recommend using Parcellite if you are a developer. – psmith Feb 20 '16 at 03:24
-
4No "synchronize clipboards" option in parcellite 0.9-1 under CentOS 6.7. Instead, installed clipit (1.4.2) via yum; does have the option, all works. Btw "settings" (actually "Preferences") are accessed by clicking the clipboard-looking icon in the systray. – Dmitri Jul 22 '16 at 19:34
-
Downloading and install directly, without using your OS's yum and/or install procedures, worked for me: https://centos.pkgs.org/7/nux-dextop-x86_64/parcellite-1.1.7-3.el7.nux.x86_64.rpm.html – HoldOffHunger Jun 02 '17 at 14:06
-
@psmith Exactly, I've noted the exact same thing. What I'd really really really like is a way to use clipboard synchronization _only_ for `gnome-terminal` etc... not for any other program. – Per Lundberg Nov 09 '18 at 14:17
-
Just installed parcellite on Ubuntu 19.04 (Gnome) and it didn't show up in tray after starting. On the other hand, ClipIt did and there's nice explanation why in (Ubuntu) package description: ClipIt was forked from Parcellite and adds many bugfixes and features to the project. For a full list of changes see either the ChangeLog in the package or http://clipit.rspwn.com/changelog/ – sm4rk0 Dec 11 '18 at 13:23
-
Thanks, I use Parcellite, but I don't want to "synchronize clipboards" behavior. This is the setting I needed to change. – Yan King Yin Dec 16 '20 at 03:57
-
ubuntu 21,04, installed clipit and nothing appeared in the try. Tried diodon instead and it worked. fyi – Goblinhack Jun 07 '21 at 11:11
It should be in the X11 clipboard. (Not the same as the GTK clipboard). Press middle-click to paste.

- 842,883
- 184
- 1,785
- 1,677
-
2gnome-terminal often fails to copy the selection. that's why i wanted it to be robust enough so that *every* time i select some text, it gets copied into the clipboard. i know about the middle-click pasting. – OTZ Jul 27 '10 at 23:59
-
5to be even more exact: i want to omit the right-click > "Copy" movements when i select a text to copy it to the clipboard. – OTZ Jul 28 '10 at 00:02
-
1@jacktrades: On Linux, usually 2-button mice can be configured so that the middle-click is emulated by [chord-clicking](http://en.wikipedia.org/wiki/Mouse_chording). – unutbu Jan 29 '13 at 21:17
SOLVED: when using Clipit . Right click / Preferences / Settings : check: Use Primary selections and Synchronize clipboards.
It is also possible to put shortcut "Ctrl grave" for Manage hotkey (grave is the `), if you were used to Ditto from windows. If not, its handy anyways to have all your previous copies at hand and searchable.
-
4Grave is not `~`, that is called a [tilde](http://en.wikipedia.org/wiki/Tilde). [Grave](http://en.wikipedia.org/wiki/Grave_accent) is `\``, an accent mark often used in the Unix world as an indicator of a command string. – Caleb Jun 17 '13 at 17:21
-
clipit seems to no longer work - the recommendation seems to be to use diodon now – Goblinhack Jun 07 '21 at 11:10
As you seem to be coming from a Windows environment I hope you are aware that the way copying and pasting works under X is a bit different from how it works under Windows. If not, for a quick introduction see Jamie Zawinski's excellent article on this subject matter X Selections, Cut Buffers, and Kill Rings.
In short: when you select some text this becomes the Primary selection (not the Clipboard selection). As others have pointed out you can paste from the Primary selection using the middle mouse button. Note however that if you close the application offering the selection, in your case the terminal, the selection is essentially "lost".
You can also use Shift+Ctrl+C in Gnome Terminal to explicitly "copy" something.

- 2,192
- 1
- 18
- 29
-
thanks for a solution that does not require more software. Ctrl+Shift+C is new to me :) – Kevin Dec 06 '17 at 21:58
On my Fedora 23, with gnome terminal 3.18.3
<Shift>+Selection
for line<Shift>+<Ctrl>+Selection
for block
Once this is done you can use
<Shift>+<Insert>
to insert IN ANOTHER terminalthe middle click
everywhere else.

- 13,672
- 21
- 91
- 162
-
To muddy the waters a little bit, I've found that `
+ – Justin Wrobel Jan 27 '23 at 14:41+ ` pastes from primary clipboard in gnome-term while ` + ` pastes from the selection clipboard (like ` `) In other applications, ` + ` pastes from the primary clipboard rather than the selection clipboard.
It used to be the default behavior in gnome-terminal as well -- but then usability experts got ahold of Linux distros, and deemed copy & paste to be too risky an activity for kernel hackers to be involved in.
But on Fedora (at least) it recently came back -- right click in your terminal and go to "input method" and select "X input method" -- you now have highlight to copy.
If you have a three button mouse, it can be pasted with the middle button (as mentioned above) but to get right click paste -- well, um...

- 5,015
- 3
- 35
- 28
I've been searching for a long time a way to emulate Putty's behavior in the default Ubuntu terminal:
- left-click to select text and copies it into the clipboard
- right-click to paste the content of the clipboard
The only solution I found, which works perfectly, is to patch the Gnome terminal (as you already guessed it).

- 3,884
- 1
- 30
- 27
I use Debian Wheezy and Gnome terminal and found a good solution is to install xsel which provides the correct copy function in the terminal.
Mouse-left-drag to select/copy text to clipboard, and I paste into vim using shift+insert keys, which are defined in Gnome terminal menu, edit, keyboard shortcuts. You can define alternative keys if wanted.
You can also install pterm a Putty like terminal emulator, that allows for the current selection to be pasted with a middle button click.

- 5,777
- 7
- 30
- 36
My Answer on superuser: https://superuser.com/a/1721880/1694169
Adding this to ~/.Xresources (create if it doesn't exist) worked for me:
xterm*selectToClipboard: true
Just Log out and back in or do a restart. Selected text will then be automatically copied and you can paste it with middle-click (when middle-click is enabled in Gnome-Tweaks)

- 1
- 1