Is there any way to set the contents of the clipboard from Mac OS X's Terminal.app?

1

1

I'd like to be able to pipe output of commands from the terminal to OS X's clipboard just like I can do to pipe output of commands to files with the > operator (cat file.txt > file2.txt).

Is there any way to do this?

esqew

Posted 2011-08-18T18:33:46.703

Reputation: 280

Answers

4

pbcopy does what you want.

http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/pbcopy.1.html

pbcopy 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 plain text 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.

slhck

Posted 2011-08-18T18:33:46.703

Reputation: 182 472