How do I send stdout to the clipboard?
There are a couple tools capable of writing to the clipboard; I use xsel
. It takes flags to write to the primary X selection (-p
), secondary selection (-s
), or clipboard (-b
). Passing it -i
will tell it to read from stdin, so you want:
$ echo "Some Text" | xsel -i -b
Using xclip
, as @Nicolas suggested, if you want to later paste the contents of the clipboard, such as using Ctrl+V, you can use it this way:
$ echo "Some Text" | xclip -selection clipboard
you can use xsel
xsel < file