Copy contents of a file to the clipboard

The xclip command is very useful when you want to copy files to the clipboard.

sudo apt install xclip

Use it as follows to put something on the internal clipboard of your VM:

cat file | xclip -selection clipboard

If you want to use it to copy something from you VM to your host machine, use the primary.

cat file | xclip -selection primary