Linux Format

A quick reference to… clipboards

-

One area of desktop Linux that causes some confusion to those more familiar with Windows is the clipboard handling. After all, it’s simple, isn’t it? You have a clipboard that you can copy to and paste from – what more could there be?

Well, another clipboard for a start. There is the primary clipboard, which behaves as you would expect, plus the X selection clipboard. Select some text in one window, move the mouse elsewhere and press the middle button and the text is immediatel­y copied. This is simple and very handy, but it is a different clipboard from the one used by standard cut and paste options.

This will bite you when you select some text and then try to paste it with Ctrl+v, or copy text with Ctrl+c and try to paste with the middle mouse button. If you have a clipboard manager, like

Copyq or KDE’S Klipper, you can transfer data between the two, as well as being able to access your clipboard’s history to retrieve previously copied data. Incidental­ly, if your mouse does not have a middle button, it is usually emulated by pressing left and right buttons together.

Copying from a terminal is slightly different, because Ctrl+c has a very different function there, so the standard clipboard keyboard shortcuts need Ctrl and Shift together. You can also use the

xclip command to copy the output of a command or the contents of a file:

$ somecomman­d | xclip

$ xclip -selection clipboard

The first example copies the output of the command to the selection clipboard, while the second copies the contents of a file to the system clipboard instead.

Newspapers in English

Newspapers from Australia