Tuesday 4 October 2011

Copy/paste text with mouse in Linux

Q. How do I copy and paste text or output from a shell prompt? How do I copy text from one terminal window and paste it on diffrent server window using mouse?

A. You can easily copy and paste between multiple shell prompts or the terminals using nothing but your mouse only. This is useful to transfer configuration lines from one terminal to another all opened over ssh session.
Most Linux distros are configured the click of a middle mouse button as paste operation. All you have to do is select text, move your most to another window and hit the middle mouse button. If you have a scroll wheel, just press on it to past the text. If you see only two buttons, just hit both button simultaneously i.e. you can emulate a third, "middle" button by pressing both mouse buttons simultaneously.

Optional: Linux Mouse configuration

Usually you can reconfigure mouse by editing /etc/X11/xorg.conf file or your distributions mouse configuration tool. You can also use xmodmap utility for modifying keymaps and mouse pointer button mappings in X. Here is my sample PS2 wheel Mouse entry:
Section "InputDevice"
         Identifier      "Configured Mouse"
         Driver          "mouse"
         Option          "CorePointer"
         Option          "Device"        "/dev/input/mice"
         Option          "Protocol"      "ImPS/2"
         Option          "ZAxisMapping"  "4 5"
EndSectio

Further readings:

  • man pages xorg, xmodmap, xsetpointer etc

Reference:

No comments:

Post a Comment