Saturday, May 4, 2024
17
rated 0 times [  17] [ 0]  / answers: 1 / hits: 11054  / 3 Years ago, thu, november 4, 2021, 3:34:20

I'm building a command line tool in order to make some of my tasks more efficient. I need to be able to write content to the clipboard, but for some reason it's not working for me.



I've tried installing both xclip and xsel, but both have the same behavior: they can read/write to the clipboard fine, but I cannot access it from the main Ubuntu GUI.



I've also tried it in the terminal...



echo "hello" | xclip


Then if Ctrl+Shift+V, I get my original clipboard entry, not "hello". But, if I try to grab the content from xclip, it works fine.



The main goal is get the content pastable into Firefox or whatever other GUI-based programs I'm using.


More From » command-line

 Answers
5

Well, there are a few different clipboards in X :) The one xclip copies text into by default is "selection buffer" - usually you just select some text with your mouse and then can paste it with middle mouse button. This buffer is separate from the one from which you can paste with Ctrl-Shift-V.



Try



echo "hello" | xclip -selection clipboard


also, see



man xclip


for more details about xclip


[#40014] Saturday, November 6, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alkeake

Total Points: 467
Total Questions: 94
Total Answers: 126

Location: Tajikistan
Member since Tue, Jun 15, 2021
3 Years ago
alkeake questions
Mon, Jul 5, 21, 09:24, 3 Years ago
Sun, Apr 23, 23, 03:29, 1 Year ago
Thu, Dec 22, 22, 20:30, 1 Year ago
;