Questions tagged [xclip]

Use this tag for questions about using the xclip utility to copy text into and from the X clipboard.

The xclip tool can be used to manage the X clipboard and move text between processes running within terminal emulators and other X11 applications.

It can be installed in Ubuntu with

sudo apt-get install xclip

See also

29 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
65
votes
2 answers

unable to paste with xclip outside of terminal

I am trying to copy from the terminal with xclip and paste it into the unity desktop environment into gedit text editor. I can copy and paste with xclip in terminal: $ cat line-size.c | xclip xclip -o > input5.txt cat input5.txt #include…
JohnMerlino
  • 7,829
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
9
votes
2 answers

Processing clipboard text through a script in between copy and paste

I want to intercept the paste event and run any text through my script. The use case is like this (assume I have a script somewhere which accepts text on stdin and turns 'world' into 'potato', writing on stdout). Highlight some text 'hello world!'…
wim
  • 13,088
4
votes
1 answer

Launching mpv from a .desktop entry with the clipboard as argument

I'm trying to make a submenu entry on a .desktop application file that launches a youtube address with mpv. The youtube url is copied from the clipboard. Inside gnome-terminal this works fine: xclip -o | xargs mpv But if I make a .desktop action…
B Jog
  • 43
3
votes
2 answers

Odd behavior of xclip

The xclip manual says that there are three storage locations named primary (XA_PRIMARY), secondary (XA_SECONDARY) and clipboard (XA_CLIPBOARD). I copied (Ctrl+c) some text from my browser and examined the contents of the three locations mentioned…
user587469
3
votes
1 answer

Add a newline at end of clipboard contents

I use xclip to copy the contents of the clipboard and pipe them to another application. However, if the last line that was copied doesn't have an end of line character, it doesn't show in the application. Question: Is there a way to add an end of…
2
votes
1 answer

How does clipboard work?

On a deep level, how does copying something to the clipboard work? Is there a file that stores the text or image I copy somewhere? I found Memory location of clipboard where the question was never answered. I also found a lot of references to xclip.…
Kaia
  • 123
2
votes
1 answer

Change character encoding in a text file

Is there a way to change the character encoding of a text file? If so, how? See, I am using a keyboard shortcut to call a shell command which itself uses xclip to copy the contents of a file into the clipboard. I can then use CTRL + V to paste the…
Juan Antonio
  • 1,602
2
votes
1 answer

Sending content to the clipboard via a Bash script

If I do echo foo | xclip -i in the terminal and then Ctrl + V, I get foo. But instead, if I write a file, bar.sh #!/bin/sh echo bar | xclip -i and run ./bar.sh in the terminal, the clipboard content doesn't become "bar" as I would expect. Why? And…
Faccion
  • 23
2
votes
1 answer

Copy to clipboard from command line

Trying to copy to clipboard from command line by using command: xclip /etc/apt/sources.list Trying to get out from clipboard: xclip -o This prints the content of sources.list and it is fine. But now I try to paste into eclipse project and got…
vico
  • 4,717
  • 23
  • 66
  • 89
2
votes
0 answers

How to set up a systemd service to listen on a socket and copy the contents to the clipboard?

I am trying to follow this tutorial which will help me copy text from remote tmux sessions onto my local clipboard. The first there is to setup a systemd service which listens on a given port on the local machine and copies the contents to the…
shahensha
  • 153
  • 5
1
vote
0 answers

xclip on remote machine

I want to paste the contents of my clipboard on machine A (client - Windows 7), to machine B (Ubuntu 16.04 Server). I followed the instructions here, but I'm still having the same problem. Here is the error message: Error: Clipboard on X11 requires…
Ali
  • 11
1
vote
1 answer

How can I feed clipboard content to gnome-terminal?

I have a plugin that generates and copies to the clipboard a ready-to-paste command. For now I open a new terminal, paste the command and execute it. I want to write a script that automatically opens a new terminal and runs that command using the…
1
2