Questions tagged [xsel]

xsel retrieves and sets the X selection. It is a simple utility meant to serve the need to copy text between the CLI environment and the GUI environment. It effectively acts as a pipeline-like interface between the CLI and the GUI clipboard.

Links:

10 questions
106
votes
7 answers

'xclip' vs. 'xsel'

There are two command-line tools (in two different packages) to access the X clipboard: xclip xsel I would love to know the difference between those two and hear a recommendation which one to use in which cases.
Byte Commander
  • 110,243
18
votes
4 answers

Alternative to xsel or xclip *without* X11 installed?

xclip/xsel need X11. When I use putty from a Windows box to linux (without X11 installed), is there an alternative to xsel or xclip? I would like to pipe the complete shell command output to the clipboard which I then paste on the Windows box to an…
I grok it
  • 191
17
votes
1 answer

Detect clipboard copy/paste event and modify clipboard contents

After something is copied to clipboard (using ctrl+c) I want a script (bash, python or any other language) to automatically detect that new entry is added to clipboard, change it's content and put it back to clipboard so when I paste it I get the…
SidMan
  • 401
2
votes
1 answer

How to disable Middle Mouse Paste on Ubuntu automatically on startup

I'm trying to make a script run on startup, so that I don't have to do it manually every time, with a terminal window being open constantly. This is the script: anti-midmouse-paste.sh #!/bin/bash while(true) do echo -n | xsel -n -i sleep…
2
votes
0 answers

How can I automate tts?

Right now I have a keybinding that uses the xsel program to grab the contents of selected text and pass it to the festival text to speech engine: #!/bin/bash xsel |festival --tts --pipe I want to have the ability to toggle a process that will…
2
votes
1 answer

Automatic transfer of clipboard copied text to some text file

I want the text copied from the mouse (clipboard or X selection), or copied with Ctrl+C, to be automatically transferred to a text file. I am using a very good website for subtitling videos called VEED [1], which automatically generates subtitles…
1
vote
0 answers

xsel output contains trash at the end if a long input is piped into it to set the clipboard

To reproduce: seq 10000 | /usr/bin/xsel -b /usr/bin/xsel -b Observed output: either of: nothing the correct output the correct output + a few lines of trash at the end The output changes randomly between those three even if I run xsel -b multiple…
1
vote
0 answers

xsel -cp clears the selected text

I'm trying to disable middle click to paste, and having tried many options and none working effectively, I am trying to use a script with xsel is a loop to clear the contents of the primary clipbord. The command I'm trying to loop is xsel…
0
votes
1 answer

xsel not working properly after upgrade to 22.04

I upgrade from Ubuntu 18.04 to 22.04 and having clipboard clearing issues using xsel If I ctrl+c in a text editor and run xsel -cb; xsel -cp; xsel -cs in terminal, the clipboard doesn't clear (ctrl+v continues to paste content). Additionally, xsel…
slatica
  • 75
0
votes
1 answer

How do I make a keyboard shortcut for code which uses xsel?

OS: Kubuntu 18.04 or Ubuntu 18.04 I want to remove the first seven characters of certain strings I copy. For example, I want to first copy and then convert 1234567890 to 890 I can do so with the following code: xsel -b -o | cut -c 8- I can put…
DK Bose
  • 44,553