3

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. – Ipor Sircer Aug 30 '16 at 15:28
0

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

| improve this answer | |
  • i tried this and the mouse selected (i.e. copied into the clip board in linux vm) did not get to shared on windows. – Minnie Shi Nov 1 '18 at 11:33
  • 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 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.