Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A command-line program for getting and setting the contents of the X selection

branch: master

Also accept UTF8_STRING for INCR transfers

See https://bugzilla.gnome.org/show_bug.cgi?id=671066 for the bug that
started this.

Xsel was only accepting XA_STRING during INCR transfers; now
it also takes in UTF8_STRING.  Maybe this bug wasn't triggered
before because most selection transfers are small, and the transfer
described in the bug is quite large.
latest commit ba8656dc7c
Federico Mena Quintero federicomenaquintero authored February 29, 2012
Octocat-spinner-32 release_notes Release 1.2.0 March 24, 2008
Octocat-spinner-32 AUTHORS Add Hans de Goede to AUTHORS March 30, 2011
Octocat-spinner-32 COPYING update to 0.9.6 sources (full tarball); conversion from Imake to GNU … September 19, 2007
Octocat-spinner-32 ChangeLog Release 1.0.0 January 12, 2008
Octocat-spinner-32 INSTALL update to 0.9.6 sources (full tarball); conversion from Imake to GNU … September 19, 2007
Octocat-spinner-32 Makefile.am as it turns out we're not actually using any of the X_PRE_LIBS or X_E… February 12, 2008
Octocat-spinner-32 NEWS update to 0.9.6 sources (full tarball); conversion from Imake to GNU … September 19, 2007
Octocat-spinner-32 README update to 0.9.6 sources (full tarball); conversion from Imake to GNU … September 19, 2007
Octocat-spinner-32 aclocal.m4 Fix logic of input/output options in pipelines December 09, 2010
Octocat-spinner-32 autogen.sh remove automatically generated files, add autogen.sh script September 19, 2007
Octocat-spinner-32 config.h.in Fix logic of input/output options in pipelines December 09, 2010
Octocat-spinner-32 configure.ac error out if libX11 is not present March 09, 2010
Octocat-spinner-32 install-sh remove automatically generated files, add autogen.sh script September 19, 2007
Octocat-spinner-32 missing remove automatically generated files, add autogen.sh script September 19, 2007
Octocat-spinner-32 mkinstalldirs update to 0.9.6 sources (full tarball); conversion from Imake to GNU … September 19, 2007
Octocat-spinner-32 rant.txt add text copy of ICCCM rant February 14, 2008
Octocat-spinner-32 stamp-h.in update to 0.9.6 sources (full tarball); conversion from Imake to GNU … September 19, 2007
Octocat-spinner-32 xsel.1x Fixed man page for xsel to remove extra -d April 13, 2011
Octocat-spinner-32 xsel.c Also accept UTF8_STRING for INCR transfers February 29, 2012
Octocat-spinner-32 xsel.h display VERSION as configured in config.h, remove definition from xsel.h December 13, 2007
README
XSel -- manipulate the X selection.

Copyright (C) 2001 Conrad Parker <conrad@vergenet.net>

For updates see http://www.vergenet.net/~conrad/software/xsel/


INTRODUCTION
============

XSel is a command-line program for getting and setting the contents of the
X selection. Normally this is only accessible by manually highlighting
information and pasting it with the middle mouse button.


To read a file into the X selection:
------------------------------------

        xsel < file

after which you can paste the file's contents into any X application with
the middle mouse button, as though you had highlighted its text. XSel will
read in the file contents exactly, whereas manual highlighting invariably
breaks lines and transforms tabs into spaces. This is especially handy for
copying in large files.


To write the X selection to a file:
-----------------------------------

        xsel > file

after which file will contain exactly the contents of the X selection,
without trailing newlines and spaces and crap.


XSel is more than just cat for the X selection.


Append to the X selection:
--------------------------

        xsel --append < file


To follow a growing file:
-------------------------

        xsel --follow < file

to make the X selection follow standard input as it grows (like tail -f).


ADVANCED FEATURES
=================

XSel also lets you access some of the more esoteric features of the
X selection:


Delete the contents of the selection
------------------------------------

        xsel --delete

Will cause the program in which text is selected to delete that text. This
really works, you can try it on xedit to remotely delete text in the editor
window.


Manipulate the secondary selection
----------------------------------

The X Window System maintains two selections, the usual primary selection
and a secondary, which isn't used much ... XSel lets you use the secondary
selection, for example:

        To get and set the secondary selection:
        ---------------------------------------

        xsel --secondary < file
        xsel --secondary > file

        To swap the primary and secondary selections:
        ---------------------------------------------
        xsel --exchange

So for example you can store useful text in the secondary selection and
retrieve it later.


Manipulate the clipboard selection
----------------------------------

Similarly, X has a clipboard selection. You can use the standard xclipboard
program to manage a history of selected text, and you can use xsel to
actually get text into that clipboard:

        xsel --clipboard < file


Make the selection contents persist in memory
---------------------------------------------

Normally the X selection only exists as long as the program it was selected
in is running. Further, some buggy applications tend to forget their
selection text after a little while. If you run:

        xsel --keep

after selecting some important text, xsel will copy the text into its own
memory so you can paste it elsewhere even if the original program exits or crashes.


Further information
===================

Naturally all these options have single character equivalents, and

        xsel --help

provides usage information. For complete details, see the xsel(1x) man page.


DOWNLOAD
========

New versions of XSel are distributed in source form from:

        http://www.vergenet.net/~conrad/software/xsel/


STANDARDS
=========

X11 ICCCM2
----------

XSel conforms to the X Window System Inter-Client Communication Conventions
Manual Version 2.0 (ICCCM2), including correct handling of TARGETS,
MULTIPLE, TIMESTAMP, and DELETE targets, INCR properties and large data
transfers.

My thoughts on ICCCM are available at:

        http://lists.slug.org.au/archives/slug-chat/2001/July/msg00054.html

(Warning: explicit language).


LICENSE
=======

Copyright (C) 2001 Conrad Parker <conrad@vergenet.net>

Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting documentation. No
representations are made about the suitability of this software for any
purpose. It is provided "as is" without express or implied warranty.


CONTACT
=======

Please direct any queries, bug reports etc. about XSel to the author,
Conrad Parker conrad@vergenet.net .
Something went wrong with that request. Please try again.