Selecting text
There are some handy mouse shortcuts for selecting text. As normal a left mouse button drag, selects text but some apps also allow the right mouse button to extend the selection. I.E. you can click or drag the right button to define the extent of the selection. Also in general double clicking selects a word, while triple clicking selects a line (try it now).Once text is selected X has 2 "clipboards" to put it in. The "selection buffer" and the "clipboard".
The selection buffer
This buffer is updated automatically when you select any text, and is generally the handiest buffer to use, as you can paste from it by clicking the middle mouse button at the required destination. I.E. by clicking the scroll button, or if you only have 2 mouse buttons you can click both simultaneously to emulate the middle mouse button.The clipboard
This works much like the windows equivalent. In general apps use the same keys as in windows to control it. I.E. CtrlInsert or Ctrlc for copy, and ShiftInsert or Ctrlv for paste etc. These key combinations may conflict with the app so for example gnome-terminal uses ShiftCtrlc and ShiftCtrlv instead, so more generally one can select copy,cut,paste from the edit menu.Buffer storage
Note it's the X application itself that maintains the storage for what it "puts" on the buffers, which makes a lot of sense when you think about it, especially considering X's network transparency. But that means when you close the application the content of the clipboard and selection buffer are lost.You can get around this behaviour by using an external application to manage the storage for the clipboard, the standard one being xclipboard. Note this is the reason why it's awkward to get a command line program to paste to the clipboard. It has to fork and run until no longer required (someone else pastes to the clipboard). See xsel for an example of this.
For handling X clipboard content from the command line see xclip.
For more clipboard details see Jamie Zawinski's article.
© Jan 12 2005