Search code examples
bashterminalcygwincat

Cat the contents of a file directly into the clipboard in cygwin terminal


I want to cat the contents of a text file directly into the clipboard rather than display the contents on the screen in a bash terminal in Cygwin.

i.e.,

cat textfile.txt > /dev/clip

Solution

  • I found an easy way to do this is to call the Windows clip program directly:

    i.e.,

    clip < textfile.txt
    

    Now the text from the file will be available to paste using the mouse right click or ctrl+v.