Scroll to navigation



xselection - get or set an X selection or cutbuffer property value


xselection [ -display display_name ] [ -append | -prepend | -replace | -clear ] [ PROPERTY_NAME | -cutbuffer [0-7] ] [- | [--] new_value ]


If the new_value argument is not given xselection retrieves the current value of the named selection property on the given display (defaults to $DISPLAY variable). The value is returned on the standard output as a string. If the new_value argument is given it is used to set the selection property's current value. This value stays until another value is set by another program. If the argument after the property name is a minus sign ('-') the new selection value is taken from the standard input. To set a minus sign as the current selection value you should turn its flag definition off using the '--' argument, e.g. xselection PRIMARY -- -

By using the '-cutbuffer' flag, the program will modify the contents of the specified cut buffer instead of a selection. The '-append', '-prepend', and '-replace' flags are used to modify how the program changes the selection. By default, it simple overwrites the selection's value (equivalent to '-replace'). By using the contents. The '-prepend' flag behaves similarly. The '-clear' flag clears the selection property or cutbuffer without forking a process to hold a blank selection. This program can be used from within shell scripts to set and retrieve the contents of the cut buffer. The standard cut buffer selection property is accessed with the property name of "PRIMARY", other selection properties are "SECONDARY", "PRIMARY_FONT" and "PRIMARY_COLOR".


DISPLAY - default X Server to enquire.


The program pays no attention to the resources specified on the server (commonly defined in $HOME/.Xdefaults).


Richard Hesketh (, University of Kent at Canterbury, March 1990
prepend/append and cutbuffer support by trost@reed.earn

31 March 1990