I'm trying to give the following command:
echo "hi" | xclip -selection c
This doesn't work? It has worked in the past, but never consistently. I also tried
echo "hi" | xclip -selection primary
echo "hi" | xclip -selection clipboard
etc….
xclip is installed (I'm pretty familiar with Linux 🙂 ) and there is no output, it just moves onto the next line and my clipboard contents do not change.
Here is my linux version:
[1450] cgeorge@uaf-7 $ cat /proc/version
Linux version 2.6.18-371.1.2.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)) #1 SMP Tue Oct 22 12:51:53 EDT 2013
Best Answer
X doesn't really have a "clipboard" by default. Selections are managed by the application that "owns" them, and if you want to copy or paste a selection, this is done by communication between both applications, which means the other application that holds the selection must still be running.
There is however a method to take over a selection, so there are generic clipboard applications like
xclipboard
, which allow other applications to "send" aXA_CLIPBOARD
selection.So, (1) either run
xclip
with option-l
so it keeps running until a second application pastes successfully (that can require several communication rounds, so-l 1
can fail), or (2) run a clipboard manager, and use-selection XA_CLIPBOARD
.You also said "you're clipboard contents don't change", but it's not really clear which "clipboard" you mean, and how the checked that.