Copy data from STDIN to the clipboard.

      pbcopy  [-pboard {general | ruler | find | font}]

   -pboard  Specify a pasteboard to copy to.
            By default the general pasteboard.

Takes the standard input and places it in the specified pasteboard. If no pasteboard is specified, the general pasteboard will be used by default.

The input is placed in the pasteboard as ASCII data unless it begins with the Encapsulated PostScript (EPS) file header or the Rich Text Format (RTF) file header, in which case it is placed in the pasteboard as one of those data types.


# Copy a list of files in your home directory to the macOS clipboard:
$ ls ~ | pbcopy

# Copy the contents of a file to the clipboard:
$ pbcopy < cookies.txt

# Copy part of a file to the clipboard:
$ grep 'ip address' serverlist.txt | pbcopy

"God shows his contempt for wealth by the kind of person he selects to receive it" ~ Austin O'Malley

Related macOS commands:

pbpaste Paste data from the Clipboard
printenv - Print environment variables

Copyright © SS64.com 1999-2019
Some rights reserved