How to put file into clipboard without losing control characters? I have a .txt file originated from Windows, so its line endings are \r\n. Running cat or echo on that file makes those control characters go away. How can I display the file (even in raw bytes if possible) while preserving the original control characters from Windows?
pbcopy will take input piped or redirected into it, and store it in a "pasteboard" (i.e. clipboard). So to copy a file verbatim, use a redirection:

pbcopy &lt; dosfile


To paste, use Commandv or

pbpaste | some_command
pbpaste &gt; some_file