I'm using URxvt 9.20 on debian jessie and I'm looking for a way to copy & paste text like I was used to with the gnome-terminal (Ctrl+Insert for copying, Shift+Insert for pasting).

It works within different urxvt consoles, it does not work between e.g. urxvt and iceweasel though.

I tried according to the manual on archlinux, but it won't work (even though I actually don't want to use Shift+Ctrl+C/V it was worth a try).


! ******************
! urxvt config
! ******************

! Disable Perl extension
! If you do not use the Perl extension features, you can improve the security
! and speed by disabling Perl extensions completely. 

! Font spacing
! By default the distance between characters can feel too wide. It's controlled
! by this entry: 
! URxvt.letterSpace: -1

! -- Fonts -- !
!URxvt*font:  -xos4-terminus-medium-*-*-*-14-*-*-*-*-*-iso8859-15,xft:terminus:pixelsize:12
!URxvt*boldFont:  -xos4-terminus-bold-*-*-*-14-*-*-*-*-*-iso8859-15,xft:terminus:bold:pixelsize:12
!URxvt*italicFont:  xft:Bitstream Vera Sans Mono:italic:autohint=true:pixelsize=12
!URxvt*boldItalicFont:  xft:Bitstream Vera Sans Mono:bold:italic:autohint=true:pixelsize=12

! Disable scrollbar
!URxvt*scrollBar: false

! Scrollbar style - rxvt (default), plain (most compact), next, or xterm
URxvt.scrollstyle: plain

! Background color
!URxvt*background: black
URxvt*background: #1B1B1B

! Font color
!URxvt*foreground: white
URxvt*foreground: #00FF00

! Other colors
URxvt*color0: black
!URxvt*color1: red3
URxvt*color1: #CD0000
URxvt*color2: green3
!URxvt*color3: yellow3
URxvt*color3: #C4A000
URxvt*color4: blue2
!URxvt*color4: #3465A4
URxvt*color5: magenta3
URxvt*color6: cyan3
URxvt*color7: gray90
URxvt*color8: grey50
URxvt*color9: red
URxvt*color10: green
URxvt*color11: yellow
!URxvt*color12: blue
URxvt*color12: #3465A4
URxvt*color13: magenta
URxvt*color14: cyan
URxvt*color15: white
! ******************
! /urxvt config
! ******************
  • You do know you can copy by selecting text with your mouse and paste by middle clicking, right? If you don't, is that enough? – terdon Jun 26 '15 at 9:10
  • 1
    The problem here is that the two programs are using different X-Windows selections, traditional programs use the PRIMARY selection with Shift+Insert, and new programs which try to mimic keybindings from other systems paste the CLIPBOARD selection for the same keybinding. In GTK+ it has become harder to paste PRIMARY without using the mouse (middle click, like @terdon said, or left+right click, if the third button emulation is on). But, while this explains why the programs are not passing the data between them, I wonder why the arch wiki suggestion didn't work. – njsg Jun 26 '15 at 9:45
  • How did you try the suggestions from ArchWIki? If you are using a graphical login screen to start X, you will need to reload the X resources using xrdb (it should be xrdb ~.Xresources or something similar). Either way, you also need to restart urxvt. In some distributions, you may need to install a separate package with the perl extensions, but this seems to be included in the base rxvt-unicode package in debian (I may be mistaken, though). – njsg Jun 26 '15 at 9:48
  • @terdon thanks for your comment. Selecting with the mouse and pasting with the middle click does work indeed. Alas it is not what I'd like to achieve, I'd like to use Ctrl+Insert/Shift+Insert like I'm used to (habits and mantras make us work efficient and fast, I'm not using the mouse often (I use i3wm).) – Thomas John Jun 27 '15 at 9:13
  • @njsg thanks a lot for explaining the primary/clipboard differences. I tried the Perl extension mentioned in the ArchWiki at "Custom key bindings", it didn't make a difference (I commented the "Disable Perl extension" part in my .Xresources out before putting it to use of course). - Yes, I did $ xrdb -merge ~/.Xresource first - Yes, I did restart urxvt, or open a new urxvt terminal windows, which has the same effect I forgot to mention a most likely important point: I don't have a desktop environment installed: - I'm only using a windows manager (i3wm) - I do use a graphical login manager – Thomas John Jun 27 '15 at 9:14

Unfortunately, the X window system has several different copy-paste mechanisms.

Rxvt, like most old-school X applications, uses the primary selection. Generally, when you select something with the mouse, it's automatically copied to the primary selection, and when you middle-click to paste, that pastes the primary selection.

Ctrl+C and Ctrl+V (or other key bindings) in applications using modern GUI toolkits, such as Gnome-terminal and Firefox, copy/paste from the clipboard.

There are tools to facilitate working with the selections. In particular, if you just want to have a single selection that's copied to whether you select with the mouse or press Ctrl+C, you can run autocutsel (start it from your .xinitrc or from your desktop environment's startup programs), which detects when something is copied to one of the selections and automatically copies it to the other.


For pasting text, in urxvt/rxvt-unicode you can use middle button to paste PRIMARY selection and Alt/Meta + middle button to paste CLIPBOARD.

For copying, just marking the text in the terminal copies it to the PRIMARY selection. Some work is needed for copying to the CLIPBOARD selection though. I combined the information from the Archlinux page you linked with scripts included in rxvt-unicode-9.19 and ended up with a script like this: https://gist.github.com/xkr47/98224ed6b0860cb55ec0. It allows one to use Ctrl-Insert or Ctrl-Shift-c to copy the currently selected text to CLIPBOARD.

Hope this helps.

For the record, I also don't run a desktop environment; using Sawfish as window manager.

Tip: You can monitor the clipboard in a terminal using either the "xclip" program:

while :; do echo -ne '\033[31;1mCLIPBOARD: ' ; xclip -o -sel c ; echo ; echo -ne '\033[32;1mPRIMARY:   ' ; xclip -o -sel p ; echo ; echo -e '\033[m--------' ; sleep 1 ; done

or using the "xsel" program:

while :; do echo -ne '\033[31;1mCLIPBOARD: ' ; xsel -b -o ; echo ; echo -ne '\033[32;1mPRIMARY:   ' ; xclip -p -o ; echo ; echo -e '\033[m--------' ; sleep 1 ; done
  • Side topic: Info on how PRIMARY and CLIPBOARD selections work in Emacs: emacswiki.org/emacs/CopyAndPaste – Jonas Berlin Oct 6 '15 at 12:18
  • Alt/Meta + middle button works for me in Debian – Jing Sep 21 '16 at 13:35
  • This is the correct answer. – Winny Apr 25 at 19:28

There are built-in mechanisms for copying/pasting to/from PRIMARY (is used when the user selects some data) and CLIPBOARD (is used when the user selects some data and explicitly requests it to be "copied" to the clipboard, such as by invoking "Copy" under the "Edit" menu of an application). More about different clipboards in X.

For CLIPBOARD buffer it is CTRL+META+C (which is CTRL+ALT+C for standard PC keyboard) for copying and CTRL+META+V (CTRL+ALT+V) for pasting.

Quotation from urxvt man:


The behaviour of text selection and insertion/pasting mechanism is similar to xterm(1).


Left click at the beginning of the region, drag to the end of the region and release; Right click to extend the marked region; Left double-click to select a word; Left triple-click to select the entire logical line (which can span multiple screen lines), unless modified by resource tripleclickwords.

Starting a selection while pressing the Meta key (or Meta+Ctrl keys) (Compile: frills) will create a rectangular selection instead of a normal one. In this mode, every selected row becomes its own line in the selection, and trailing whitespace is visually underlined and removed from the selection.


Pressing and releasing the Middle mouse button in an urxvt window causes the value of the PRIMARY selection (or CLIPBOARD with the Meta modifier) to be inserted as if it had been typed on the keyboard.

Pressing Shift-Insert causes the value of the PRIMARY selection to be inserted too.

rxvt-unicode also provides the bindings Ctrl-Meta-c and to interact with the CLIPBOARD selection. The first binding causes the value of the internal selection to be copied to the CLIPBOARD selection, while the second binding causes the value of the CLIPBOARD selection to be inserted.

  • Why don't I ever think solutions are in man page? Now everything's clear to me! Thank you! – Enrico Maria De Angelis Jun 9 '18 at 12:43
  • 1
    By the way, I've kept forgetting which one between primary selection and clipboard is pasted to when I select something before right-clicking and pasting. Now it's clear: beforePRIMARY. – Enrico Maria De Angelis Jun 9 '18 at 12:47

You can make urxvt copy to both Primary and Clipboard with the selection-to-clipboard perl extenion. This keeps them in sync, so you just copy once in urxvt and it should work in applications that use either.

URxvt.perl-ext-common: selection-to-clipboard
  • 2
    Can I change shorcut for this extension? I do not like default ctrl-alt-c/v. I would like to have ctrl-shift-c/v. – Trismegistos Jul 12 '16 at 18:46
  • 3
    @Trismegistos , have a loook here – najjarammar Jul 21 '16 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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