XSEL(1)

NAME
xsel - access the X selection from command line

SYNOPSIS
xsel (--paste | --copy [string] | --merge [string]) [-display display] [-selection selection]

DESCRIPTION
This program is used to access the X selection (PRIMARY, SECONDARY, CLIBOARD) from command line.

ACTIONS

-p or --paste
    Paste the current X selection to (if any) standard output and exit.

-c or --copy
    Read the input from the standard input to offer is as the X selection. Note that the X selection model has no concept of selection buffer on the server. Rather, the client that holds the current selection makes it available to the other clients and has to wait until someone requests it. Hence, xsel forks and serves the selection requests until someone else claims the selection. The copied string can also be given on command line rather than through standard input: --copy "string to copy".

-m or --merge
    Same as --copy, but merge the input to the current selection instead of overwriting it.

OPTIONS

-display display
    This option specifies the server to use; see X(7x).

-s selection or --selection selection
    This option specifies which X selection to use: PRIMARY (default), SECONDARY or CLIPBOARD. You can also use abbreviations P, p, S, s, C and c. There are some historical conventions: PRIMARY is used for mouse selection, middle mouse button paste, and explicit cut/copy/paste menu items (Qt, Emacs) CLIPBOARD is USED for the Windows-style cut/copy/paste menu items; use PRIMARY for the currently-selected text, even if it isn't explicitly copied, and for middle-mouse-click (Netscape, Mozilla, XEmacs, some GTK+ apps) Generally, SECONDARY is not used.

EXAMPLES

ls | xsel --copy
    Copy ls output to X selection.

xsel --copy Hello
    Copy the string "Hello" to X selection.

xsel --merge Hello
    Merge the string "Hello" to the current X selection.

xsel --selection CLIPBOARD --copy Hello
    Copy the string "Hello" to X SECONDARY selection.

xsel --paste | wc
    Count words in the current X selection.

BUGS
Xsel sometimes opens a small window that is not always visible. With my configuration, it never shows up, so I'm not eager enough to figure out how to get rid of it.

SEE ALSO
X(7x), xcutsel(1)

AUTHOR
Ralph Swick (DEC/Project Athena) wrote xcutsel, xsel is based on it. Ville Herva <Ville.Herva@iki.fi> wrote xsel.