3

Possible Duplicate:
Copy file to xclip and paste to Firefox

I would use the following command to copy the output of uptime to the clipboard:

uptime | xclip

Then I can paste the copied uptime to the console by clicking the middle button of mouse. But when I go to an application like "gedit", there is no Paste option available there. How can I copy a text into clipboard so that it could be pasted onto something like "gedit"?

B Faley
  • 4,213
  • 11
  • 37
  • 48

1 Answers1

2

I was having a similar issue until I did the following (on Ubuntu):

uptime | xclip -selection c

From the man pages:

-selection
             specify  which X selection to use, options are "primary" to
             use XA_PRIMARY (default), "secondary" for  XA_SECONDARY  or
             "clipboard" for XA_CLIPBOARD
colson
  • 36
  • 2
  • 1
    Note that the shorthand `uptime | xclip -se c` would also do, since xclip admits abbreviations provided they don't conflict with valid options and keywords (`-silent` and `-selection`, for example) – XavierStuvw Jul 16 '18 at 08:32