Accessing the clipboard from OS X command-line


pbcopy and pbpaste are the OS X alternatives to the POSIX tool xclip.

pbcopy takes the standard input and places it in the specified paste-board. If no pasteboard is specified, the general pasteboard will be used by default.

pbpaste removes the data from the pasteboard and writes it to the standard output.

For example:

user@host:~/Projects/some/dir/that/is/long$ pwd | pbcopy

The working directory is now in your system clipboard, available for you to paste somewhere.

Additional links

  1. pbcopy / pbpaste in OS X
  2. Clipboard access from shell (utf-8)

Tags:

This entry was posted on Wednesday, April 22nd, 2009 at 10:03 pm and is filed under OS X. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

5 Responses to “Accessing the clipboard from OS X command-line”

  1. ??????? said this on

    ???, ? ?? ??????? ?? ?????????? ? ?????????? ??????????????, ?? ? ????? ??? ????? ????????.

  2. ripse said this on

    I turned on my iPhone today and the camera icon on the main page was gone. How do I get it back?

    ________________
    [url=http://www.youtube.com/watch?v=3Fxu3GoTVFc]unlock iphone 3g[/url]

  3. sIunDTzx said this on

    Hi! THtHrDY

  4. Auto Insurance said this on

    Hi Santiago. So fare i can see, Schomer has answered your question. I don’t see any sense.

  5. qyasosareyys said this on

    ???????????????? ???????? ??????????. ???????? ?????? ???????? ???????? ???????? ?????????.

    ??????????:[url=http://www.filpan.ru] ???????? ?????????? hp , ???????? ?????????? brother , ???????? ?????????? OKI , ???????? ?????????? Konica-minolta[/url], ??? ???????? ????????? ? ???????.

    ????? ?? ???????? ?????????? ? ???? ????????? 943 - 07- 73 ???.
    ?????? ? ???????: [url=http://www.filpan.ru] ?????? , ?????? ??? ???????? ????????? HP.[/url]

    ??????? [url=http://www.filpan.ru]???????? Samsung SCX 4623 , WC Xerox 3220 , Xerox SCX 3200 , Xerox WC 220 , HP C2624A , HP Q1338A , HP ??285? , HP CC364? , Samsung - SCX 4100.[/url]

    [url=http://www.filpan.ru]???????? ???????? Samsung SCX 4623 fn , Xerox WC 3210 , Xerox WC 3500 , Samsung SCX 4824 , Xerox WC 114 , HP C2613A , HP CC364X , Samsung SCX 4220 , Samsung MLT -109 S ( Samsung SCX 4300 ) , Samsung MLT-D108. [/url]

    ???????? ??????? ??? ?????: [url=http://www.filpan.ru]?????? Canon MF 4410 , Canon i-SENSYS MF4320d , Brother DCP-7032R[/url]