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 <stdio.h>
...
However, when I press control + v to paste into gedit, it only pastes the actual last thing I copied within unity desktop, such as something from firefox browser.
How can I paste in gui applications something I copied from terminal?
I think it is just a matter of understanding the different selection clipboards used by the
xclip
utilityWhen you do
cat line-size.c | xclip
the default behaviour is to copy to the primary X selection buffer - to paste from that buffer, you need to use a mouse middle-click instead of the Ctrl+v combination.To copy into the clipboard instead, so that you can paste with Ctrl+v, you would need to do
Just in case if someone is looking for a shortest version without using aliases. By using
something|xclip -se c
instead of just baresomething|xclip
you can press Ctrl+V/Ctrl+Shift+V and see a desirable result. Wheresomething — cat somefile.txt
for example.