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)
Share this post
  • Digg
  • StumbleUpon
  • Reddit
  • del.icio.us
  • Facebook
  • muti
  • Mixx
  • Google
  • laaik.it

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. You can leave a response, or trackback from your own site.

3 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

Leave a Reply