Name

pbpaste — stdin  stdout  - file  -- opt  --help  --version

Synopsis

pbpaste [options]

pbpaste is the companion to pbcopy: it copies the contents of the Macintosh clipboard to standard output. For example, to count the number of words in a TextEdit document, copy the document’s text to the clipboard and then run:

pbpaste | wc -w
94821

Run without any arguments, pbpaste simply prints the clipboard contents on standard output (onscreen). To copy the contents to a text file, run:

pbpaste > outfile.txt

If you’re bored, try this useless pipe command:

pbpaste | pbcopy

which copies the clipboard back into itself. As with pbcopy, to get the most out of pbpaste, you should be using the desktop and Terminal, not logged in from a remote system via SSH.

Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.