I have this nice alias which works well within my Ubuntu when I need to copy some terminal output right into my clipboard:

alias xclip='xargs echo -n | xclip -selection clipboard'

Now something like cat myfile | xclip and I have output in the clipboard ready to be pasted within Ubuntu, which is really handy.

However, this does not work if I want to paste into my Windows 10 host (I am using Ubuntu VM). I always select and Ctrl+Shift+C, but I would love to be able to copy command output straight into clipboard just like selecting and Ctrl+Shift+C. Is there similar thing to xclip where I can copy/paste from Ubuntu to Windows 10 without mouse selection?

  • Take a look at program xcutsel. Linux has more than one clipboard, and vmware/virtualbox copy automatically only one. Aug 30, 2016 at 15:28

1 Answer 1


Using the primary clipboard as target works for me (Ubuntu). I can paste the string into my VMware host (provided that clipboard sharing is configured correctly):

echo hello | xclip -selection p

or shorter:

echo hello | xclip -i

  • i tried this and the mouse selected (i.e. copied into the clip board in linux vm) did not get to shared on windows. Nov 1, 2018 at 11:33
  • 1
    Both primary (-p) and clipboard (-c) don't work for me for pasting to windows reliably. Just sometimes when I first do xclip -selection primary then xclip -selection secondary pasting to windows works. When I use xclip -selection primary I can't even past it to other programs in the Ubuntu VW. Very strange behavior.
    – fivef
    Feb 7, 2020 at 13:20
  • This actually hinted me in the right direction. The solution that then worked for me, was this: unix.stackexchange.com/a/69134/147659
    – d4Rk
    Dec 22, 2021 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .