I installed OpenBSD 5.5 using the recommended defaults. The OS came with fvwm as the window manager.

How do I copy text within an Xterm and paste it into another Xterm? Using the mouse? Using only the keyboard?

Before making this post, I checked the man page of fvwm and there is nothing that answers my question.


Select the text to copy and then use the middle mouse button in the other window to paste the selected text. Even if no longer selected you can paste last selected string.

  • 1
    Your method works. What if I wish to use the keyboard only? Could you or someone here show me how to use the keyboard to achieve the same result?
    – user66229
    Sep 1 '14 at 20:03
  • 2
    @user66229 Xterm doesn't offer a way to select with the keyboard. You can use Shift+Insert to paste. Sep 1 '14 at 20:28
  • 1
    @Gilles Thanks. If that's the case, what is a more user-friendly terminal emulator software that I should install on OpenBSD? [Xterm is known as a terminal emulator, isn't it]
    – user66229
    Sep 2 '14 at 6:50

Xterm provides a way to do select/paste using the keyboard, but (a) it is not often used and (b) requires a little work to configure it.

Refer to Default Key Bindings in the manual, to see that there are predefined bindings including these:

        Shift <KeyPress> Select:select-cursor-start() \
                                select-cursor-end(SELECT, CUT_BUFFER0) \n\
        Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\

Those are analogous to the mouse-oriented translations

         ~Ctrl ~Meta <Btn3Down>:start-extend() \n\
             ~Meta <Btn3Motion>:select-extend() \n\
           ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\

The actions can be bound to keys (or modified keys) of your choice. The existing binding is useful as is if you happen to have a Select and Insert key on your keyboard. If you do not, you could either use xmodmap to map existing keys to those symbols, or you could use the translations as a model for making your own customized translations.

In both, you may notice the SELECT target, which xterm uses with the selectToClipboard resource to provide a runtime switch (with a menu entry) between the PRIMARY and CLIPBOARD targets.

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.