Saturday, May 4, 2024
43
rated 0 times [  43] [ 0]  / answers: 1 / hits: 46777  / 1 Year ago, sun, april 23, 2023, 5:56:17

I want to pipe/dump the contents (esp. text) of the clipboard/Ctrl+C to a file, preferably using Bash or Perl (in order). I'd rather not use GUI applications please.


More From » command-line

 Answers
1

How to pipe clipboard contents to a file?


You can do it using xsel. Type in terminal to install it,


sudo apt-get install xsel

To put the contents of a file to the clipboard use:
xsel -b < some.txt


To paste the contents of the clipboard to a file use.


`xsel -b >> some.txt`

Copy file content/string to clipboard


You can go through this answer by Radu Rădeanu which described how you can copy file content/string from a terminal to clipboard that can be pasted using Ctrl+V


[#28231] Monday, April 24, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
measord

Total Points: 259
Total Questions: 131
Total Answers: 106

Location: Venezuela
Member since Sun, Oct 2, 2022
2 Years ago
measord questions
Wed, Jul 14, 21, 21:39, 3 Years ago
Mon, May 16, 22, 21:12, 2 Years ago
Mon, Oct 11, 21, 03:11, 3 Years ago
Sun, Apr 17, 22, 21:22, 2 Years ago
;