Copy Command Line Output to the Clipboard on Mac and Windows

Published: Oct 12, 2018 • Updated: May 3, 2021

In each example below, the contents of a file are copied to the clipboard.

Mac #

cat <file> | pbcopy

Windows #

type <file> | clip