Unable to copy fast a file to clipboard in a Linux computer

12,385

Solution 1

In addition to xsel and xclip already mentioned there is also uclip. From the manual page description:

uclip is a command-line interface to the X clipboard. It either copies text, from FILE or from stdin, to the X clipboard, or prints the X clipboard to std- out. uclip supports Unicode and is locale-aware (in contrast to other similar utilities). uclip was written using Qt.

Update: Apparently uclip was not such a good recommendation because it currently does not work for copying, see here for the problem description (and hopefully a solution some day?).

Solution 2

does xclip suits you?

Solution 3

The Linux equivalent of pbcopy is xclip.

Solution 4

Try xsel. It does wonders, but it doesn't really work with the clipboard, but rather with the X selection buffer.

cat file | xsel

and then you can click the mouse wheel to paste the contents.

Share:
12,385
Michal aka Miki
Author by

Michal aka Miki

Vacare.

Updated on August 03, 2022

Comments

  • Michal aka Miki
    Michal aka Miki almost 2 years

    I have not yet found an easy solution to copy your file to a clipboard in Linux, similarly as in Mac by

    cat file | pbcopy
    

    I tried to use the following command in Vim unsuccessfully

    :copy 1,9999999
    

    to copy the file.

    How can you copy a file fast to your clipboard in Linux such that you can then paste it to dpaste?

  • Michal aka Miki
    Michal aka Miki about 15 years
    Thank you for mentioning xsel. It raised me another problem: how to configure Mackbook touchpad to understand the mouse wheel button. I need get the xmod code first for the button.
  • Michal aka Miki
    Michal aka Miki about 15 years
    This is an excellent link for the tips about the commands: cyberciti.biz/faq/…
  • Timo
    Timo over 11 years
    Yes, but simply calling xclip doesn't do it by default. If I append it with the following options the -sel clip or -selection clipboard then I can paste the output to my browser etc.. echo "http://superuser.com/" | xclip -sel clip, alt-tab to chrome, ctrl+l, ctrl+v, enter... vola! P.S. I don't know if xsel has similar options to make it work. By default it doesn't work.
  • Timo
    Timo over 11 years
    What's the point of using keyboard commands to copy something if you need a mouse to paste it?? O.O