Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Under different Unix/Linux systems I've observed different double click behavior in X terminal applications (e.g. xterm).

Sometimes a double click selects everything left and right until the next non-alphabetic character (e.g. it selects the word under the cursor).

Sometimes everything until the next blank/eol is selected (e.g. full paths under the cursor are selected).

How can I configure the double click behavior - say - in xterm (because it is available on most systems)?

Currently, I find the 2nd mode more convenient for most use cases.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You do it with X resources. I have a file, .Xresources, that contains these xterm-related resources:

XTerm*VT100.cutNewLine: false
XTerm*VT100.cutToBeginningOfLine: false
XTerm*VT100.charClass: 33:48,35:48,37:48,42:48,45-47:48,64:48,95:48,126:48

In my .xinitrc file, I have some line that merge in those resources:

if [ -f $userresources ]; then
    /usr/X11/bin/xrdb -merge $userresources

Those lines make xterm double-clicks and triple-clicks do what I like:

Double-click considers a "word" to include slash (/), dot (.), asterisk (*) and some other non-alphanumeric characters. That's the "charClass" resource. I had to do some tedious fiddling with that charClass to get it to do what I want. That mostly lets you double-click on URLs and fully- or partially-qualified paths to highlight them.

The other two lines make triple-click start from the word under the mouse, and go to the end of the line, but not include any new-line. That way, you can triple click on a command you just executed, paste it in another window, and because it has no new-line, you can edit it before running it in the other window.

The Arch Wiki has an article on X resources, including a section on xterm resources, but those xterm resources aren't complete.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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