Showing posts from January, 2010

Easy copy-pasting in X

Check what the clipboard contents are: xsel -b Put foo in the primary X selection: echo foo | xsel -p Copy the clipboard to the primary X selection: xsel -b | xsel -p This is just a hint on how to copy/paste between X programs that cannot agree on which X buffer to use. Say you have the xterm which uses the primary selection, and you have some silly java program program which only uses the clipboard. What do you do if middle click doesn't want to paste your console output. An ugly workaround is to fire some editor that supports both and keep pasting with one method and copying with the other before pasting in the final destination. Middle click in gvim to paste what you selected in your xterm, then select the text in gvim and copy it to the clipboard. Or, you can use xsel . The simple features of xsel are to put something in one of the selections (if there is anything coming on STDIN) or to output the content of a buffer. So, to put the primary (the one you get when you selec