I ran the minimal Debian installation inside a VirtualBox instance, installed X11 and Awesome window manager manually (without any custom configuration yet) and installed VirtualBox additions as well (and enabled shared clipboard in settings). However, copy-pasting text from xterm terminal still doesn't seem to work: CTRL+C is sent as a signal to a terminal, and Shift+Insert inserts the text that I had selected (which probably means that it got copied to some buffer somehow), but it is still unavailable from the host operating system.

5 Answers 5


X11 uses two buffers: PRIMARY and CLIPBOARD. To copy/paste to the CLIPBOARD buffer you can often use CTRL-C and CTRL-V. You can insert to the PRIMARY buffer by selecting a text and paste from it by pressing the middle mouse button.

If you want to use the CLIPBOARD buffer, put this in your ~/.Xresources file and use Ctrl+Shift+C and Ctrl+Shift+V to copy/paste from/to the CLIPBOARD buffer in xterm:

xterm*VT100.Translations: #override \
                 Ctrl Shift <Key>V:    insert-selection(CLIPBOARD) \n\
                 Ctrl Shift <Key>C:    copy-selection(CLIPBOARD)

You need to run xrdb -merge ~/.Xresources after putting that into the file.

  • 3
    Using xrdb ~/.Xresources will destructively overwrite your default configuration. instead use xrdb -merge ~/.Xresources
    – xaedes
    Apr 26, 2017 at 12:17

It is not necessary to modify the xterm translations resources to copy data to/from Firefox, unless you prefer to use the keyboard to help with the process.

Since 2006 xterm has a feature selectToClipboard which lets you switch between the PRIMARY selection (standard) and CLIPBOARD (Firefox, etc).

Because some programs do use the primary selection, and some don't, it is a menu entry in xterm (controlmiddle-mouse):

show selectToClipboard in menu-entry

Adapting the suggestion for control-characters like the GNOME applications lets you use the keyboard, and at the same let the menu switch between the two types of selections:

xterm*VT100.Translations: #override \
                 Ctrl Shift <Key>V:    insert-selection(SELECT) \n\
                 Ctrl Shift <Key>C:    copy-selection(SELECT)

although adding shiftInsert might be closer to the original intent:

xterm*VT100.Translations: #override \
                 Shift <Key>Insert:    insert-selection(SELECT) \n\
                 Ctrl Shift <Key>V:    insert-selection(SELECT) \n\
                 Ctrl Shift <Key>C:    copy-selection(SELECT)

A plain controlC is usually assigned to an INTR signal:

$ stty -a
speed 38400 baud; rows 40; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

Further reading:

  1. Open xterm and highlight the text you want to copy.
  2. Go to the application in which you wish to paste and hover the mouse cursor over the field you want to paste in.
  3. Click the scroll button on your mouse. (on laptops this can be done by pressing left and right click at the same time)

When you highlight text, it copies the text to your primary buffer. Keep in mind that if you highlight any other text before pasting, that text will then replace the previous content in the primary buffer.

  • 1
    Please, read question carefully. "Go to the application in which you wish to paste" — this suggests that you didn't notice that I needed to paste it into the host OS.
    – Max Yankov
    Aug 24, 2015 at 8:39
  • 1
    Sorry I don't have third button on the mouse. using trackball in here
    – holms
    Feb 23, 2018 at 12:42
  • This is the ONLY recommendation that worked for me using an Azure Debian vm running xterm, connected by Microsoft Remote Desktop on macOS. I was able to paste into a Debian text editor. I did have to attach a mouse to my Mac. Sep 26, 2021 at 22:24

Turns out, I didn't account for the fact that X11 has two buffers: primary and clipboard. My text from xterm was copied into primary buffer, while I needed it in clipboard buffer.

I was able to fix the problem by installing parcellite package, launching it and configuring it to synchronize two buffers.


What worked for me (openSuSe 42.3 x86_64) was extracted from https://www.davidsimmons.com/soft/xtermhacks/#copynpastenopatch. You can also check https://askubuntu.com/questions/237942/how-does-copy-paste-work-with-xterm/1300290#1300290 for other responses.


Add to ~/.Xresources:

XTerm*VT100.translations: #override <Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)
and the run xrdb -merge ~/.Xresources.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .