XSEL(1x)

πŸ“¦
version 1.2.1 Β· 3 versions
, in alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… XSEL β€” the manual page, but make it cute

okay bestie, welcome to xsel(1x) β€” your new favorite lil X selection gremlin πŸŽ€


✨ NAME ✨

xsel β€” manipulate the X selection. that's it. that's the whole job. she does one thing and she ATE. πŸ‘‘


🌸 SYNOPSIS 🌸

xsel [OPTION]...

πŸ¦‹ DESCRIPTION πŸ¦‹

Retrieve and set the X selection. simple on the surface, lowkey unhinged underneath, iykyk πŸ’€

So here's the tea: the X server keeps three selections, and their names are:

  • PRIMARY β€” the conventionally-used one for copying and pasting with the middle mouse button. this is the main character.
  • SECONDARY β€” less frequently used by application programs πŸ₯²
  • CLIPBOARD β€” also less frequently used by application programs 🫢

This program operates on the PRIMARY selection unless you say otherwise, bestie.

Now the default behaviour, and listen closely because this is the part everyone gets wrong:

By default, this program outputs the selection without modification if both standard input and standard output are terminals (ttys). Otherwise:

  • the current selection is output if standard output is not a terminal (tty), and
  • the selection is set from standard input if standard input is not a terminal (tty).

If any input or output options are given, then the program behaves only in the requested mode. no vibes-based guessing, we're being explicit now πŸ’…

And if both input and output are required? The previous selection is output before being replaced by the contents of standard input. iconic behaviour, honestly.


πŸ“ Input options

  • -a, --append β€” append standard input to the selection. Implies -i. πŸ’–
  • -f, --follow β€” append to selection as standard input grows. Implies -i. she's watching. respectfully. πŸ‘€
  • -i, --input β€” read standard input into the selection.

🧚 Output options

  • -o, --output β€” write the selection to standard output.

⭐ Action options

  • -c, --clear β€” clear the selection. Overrides all input options. bye bye selection 🫑
  • -d, --delete β€” Request that the current selection be deleted. This not only clears the selection, but also requests to the program in which the selection resides that the selected contents be deleted. Overrides all input options. yeah she's not just clearing, she's asking your source app to delete the text too. aggressive. love that for her. πŸ”₯

🌈 Selection options

  • -p, --primary β€” operate on the PRIMARY selection (default). ✨
  • -s, --secondary β€” operate on the SECONDARY selection.
  • -b, --clipboard β€” operate on the CLIPBOARD selection.
  • -k, --keep β€” Do not modify the selections, but make the PRIMARY and SECONDARY selections persist even after the programs they were selected in exit. (Conventionally, the CLIPBOARD selection is persisted by a separate special purpose program such as xclipboard(1)). Ignores all input and output options. she stays. 🫢
  • -x, --exchange β€” exchange the PRIMARY and SECONDARY selections. Ignores all input and output options. swap swap swap πŸ”„

πŸ’œ X options

  • --display displayname β€” specify the server to use; see X(1).
  • --windowName windowName β€” specify the X WM_NAME window property; default is "xsel".
  • -t ms, --selectionTimeout ms β€” Specify the timeout in milliseconds within which the selection must be retrieved. In --input mode, the background process exits after this amount of time. A value of 0 (zero) specifies no timeout (default). ⏰

πŸŽ€ Miscellaneous options

  • -l filename, --logfile filename β€” Specify the file to log errors to when detached. (Default $HOME/.xsel.log)
  • -n, --nodetach β€” Do not detach from the controlling terminal. Without this option, xsel will fork to become a background process in input, exchange and keep modes. no ghosting the terminal today πŸ™ˆ
  • -h, --help β€” display usage information and exit
  • -v, --verbose β€” Print informative messages. Additional instances of -v raise the debugging level, ie. print more information. the more -vs, the more she talks. she's an open book πŸ“–
  • --version β€” output version information and exit

πŸ’€ NOTES πŸ’€

There is no X selection buffer. okay? none. stop looking for one, bestie, it's not there.

The selection mechanism in X11 is an interclient communication mediated by the X server each time any program wishes to know the selection contents, eg. to perform a middle mouse button paste.

In order to implement modification of the selection(s) (in input, keep and exchange modes) this program detaches from the terminal, spawning a child process to supply the new selection(s) on demand. This child exits immediately when any other program takes over the selection(s), eg. when the user next selects some text in a terminal window or by running xsel -c. so yeah, she spawns a lil helper and that helper dips the second someone else takes the selection. drama. πŸ’…


πŸ‘‘ STANDARDS πŸ‘‘

xsel conforms to the Inter-Client Communication Conventions Manual Version 2.0 (ICCCM2). she's certified, she's compliant, she read the docs. periodt. 🌟


πŸ”₯ SEE ALSO πŸ”₯

X(7), Xserver(1), xset(1), xclipboard(1), xpaste(1)


πŸ’– AUTHOR πŸ’–

Conrad Parker <conrad@vergenet.net>, July 2001


and that's the whole thing, bestie πŸ₯Ήβœ¨ this page came to you from the January 2008 era of the XSEL(1x) manual β€” dated, iconic, and still doing the most. go copy something. πŸ’…πŸŽ€