Skip navigation.

rantshoutwhisper

Posts tagged with "xterm"

XTerm: copying to the clipboard an easy way

, ,

Xterm is the simple commandline window that comes with most distibutions of Linux. Copying and pasting are not obvious, to say the least. Text just has to selected with the mouse to be copied; but that text goes somewhere called the primary buffer. From reading this, I suspect it's a standard. But it has to be said that I don't really understand it, and I'm not certain I should have to.

There are pages that will tell you how to change the behaviour so that your text goes to the clipboard: but these didn't work for me. So if they aren't working for you, here's another solution.

You'll need to edit your menu. I'm on Fluxbox, so I open up a text-editor and open up ~/.fluxbox/usermenu. I suspect you could use Alacarte or Kmenu for Gnome and KDE respectively.

Find the entry for xterm and replace what you have with

xterm -xrm 'XTerm*selectToClipboard: true'



So in Fluxbox the entry would be

[exec] (terminal) {xterm -xrm 'XTerm*selectToClipboard: true'}



Then save. When you open xterm and select text with a mouse, it goes to the clipboard. Where you thought it would go in the first place. You can still paste the text into another terminal with Shift+Insert: but you can paste into pretty much everything else with Ctrl+v.

I read the man page for xterm, which is how I thought of doing this. But the fact that I had to think about it, read the man page and then guess until it worked is quite frustrating.
Download Opera, the fastest and most secure browser