xsel

Program for manipulating the X clipboard
git clone https://git.sinitax.com/kfish/xsel
Log | Files | Refs | README | LICENSE | sfeed.txt

README (4540B)


      1XSel -- manipulate the X selection.
      2
      3Copyright (C) 2001 Conrad Parker <conrad@vergenet.net>
      4
      5For updates see http://www.vergenet.net/~conrad/software/xsel/
      6
      7
      8INTRODUCTION
      9============
     10
     11XSel is a command-line program for getting and setting the contents of the
     12X selection. Normally this is only accessible by manually highlighting
     13information and pasting it with the middle mouse button.
     14
     15
     16To read a file into the X selection:
     17------------------------------------
     18
     19        xsel < file
     20
     21after which you can paste the file's contents into any X application with
     22the middle mouse button, as though you had highlighted its text. XSel will
     23read in the file contents exactly, whereas manual highlighting invariably
     24breaks lines and transforms tabs into spaces. This is especially handy for
     25copying in large files.
     26
     27
     28To write the X selection to a file:
     29-----------------------------------
     30
     31        xsel > file
     32
     33after which file will contain exactly the contents of the X selection,
     34without trailing newlines and spaces and crap.
     35
     36
     37XSel is more than just cat for the X selection.
     38
     39
     40Append to the X selection:
     41--------------------------
     42
     43        xsel --append < file
     44
     45
     46To follow a growing file:
     47-------------------------
     48
     49        xsel --follow < file
     50
     51to make the X selection follow standard input as it grows (like tail -f).
     52
     53
     54ADVANCED FEATURES
     55=================
     56
     57XSel also lets you access some of the more esoteric features of the
     58X selection:
     59
     60
     61Delete the contents of the selection
     62------------------------------------
     63
     64        xsel --delete
     65
     66Will cause the program in which text is selected to delete that text. This
     67really works, you can try it on xedit to remotely delete text in the editor
     68window.
     69
     70
     71Manipulate the secondary selection
     72----------------------------------
     73
     74The X Window System maintains two selections, the usual primary selection
     75and a secondary, which isn't used much ... XSel lets you use the secondary
     76selection, for example:
     77
     78        To get and set the secondary selection:
     79        ---------------------------------------
     80
     81        xsel --secondary < file
     82        xsel --secondary > file
     83
     84        To swap the primary and secondary selections:
     85        ---------------------------------------------
     86        xsel --exchange
     87
     88So for example you can store useful text in the secondary selection and
     89retrieve it later.
     90
     91
     92Manipulate the clipboard selection
     93----------------------------------
     94
     95Similarly, X has a clipboard selection. You can use the standard xclipboard
     96program to manage a history of selected text, and you can use xsel to
     97actually get text into that clipboard:
     98
     99        xsel --clipboard < file
    100
    101
    102Make the selection contents persist in memory
    103---------------------------------------------
    104
    105Normally the X selection only exists as long as the program it was selected
    106in is running. Further, some buggy applications tend to forget their
    107selection text after a little while. If you run:
    108
    109        xsel --keep
    110
    111after selecting some important text, xsel will copy the text into its own
    112memory so you can paste it elsewhere even if the original program exits or crashes.
    113
    114
    115Further information
    116===================
    117
    118Naturally all these options have single character equivalents, and
    119
    120        xsel --help
    121
    122provides usage information. For complete details, see the xsel(1x) man page.
    123
    124
    125DOWNLOAD
    126========
    127
    128New versions of XSel are distributed in source form from:
    129
    130        http://www.vergenet.net/~conrad/software/xsel/
    131
    132
    133STANDARDS
    134=========
    135
    136X11 ICCCM2
    137----------
    138
    139XSel conforms to the X Window System Inter-Client Communication Conventions
    140Manual Version 2.0 (ICCCM2), including correct handling of TARGETS,
    141MULTIPLE, TIMESTAMP, and DELETE targets, INCR properties and large data
    142transfers.
    143
    144My thoughts on ICCCM are available at:
    145
    146        https://web.archive.org/web/20110720132303/https://lists.slug.org.au/archives/slug-chat/2001/July/msg00054.html
    147
    148(Warning: explicit language).
    149
    150
    151LICENSE
    152=======
    153
    154Copyright (C) 2001 Conrad Parker <conrad@vergenet.net>
    155
    156Permission to use, copy, modify, distribute, and sell this software and its
    157documentation for any purpose is hereby granted without fee, provided that
    158the above copyright notice appear in all copies and that both that copyright
    159notice and this permission notice appear in supporting documentation. No
    160representations are made about the suitability of this software for any
    161purpose. It is provided "as is" without express or implied warranty.
    162
    163
    164CONTACT
    165=======
    166
    167Please direct any queries, bug reports etc. about XSel to the author,
    168Conrad Parker conrad@vergenet.net .