How to load a file’s contents into the clipboard

clipboardcopy/paste

I have a files where I need to copy their contents to another file or into an application and rather than open it up, select all the text then copy and paste I'd like to know if I can effectively cat the file contents into the clipboard. Is this possible?

A Windows program would be fine but something that works on Linux would be useful too. I don't use a Mac but it might be useful to others. Bonus points if this can be done on the command line.

Best Answer

Since you didn't ask about Macs: cat file | pbcopy (and likewise pbpaste) for those.

Related Question