Subscribe to William Computer Blog : Entries & Del.icio.us. Add this blog to Technorati Favorites

pbcopy and pbpaste

I found an interesting new command on Mac OS X called pbcopy and pbpaste. These two commands provide copying and pasting from command line.

pbcopy takes standard input and place it in the specified pasteboard. Example use of pbcopy, type the following in your terminal:

$ ls -la | pbcopy

The results of that unix command will now be placed in the pasteboard. Now, you can paste that result into Mac OS X program such as Safari, Mail.app, TextMate, Microsoft Word, Microsoft Excel, etc.

The pbpaste removes the data from the pasteboard and writes it into the standard output. You can now copy things from Mac OS X software and paste it in terminal. Example:

  1. Copy a paragraph of text from Mac OS X software (i.e Safari)
  2. Open up terminal
  3. type pbpaste > file.txt
  4. A new file called file.txt will be created with things from your pasteboard in it

Comment is disabled on this entry

Commenting is disabled on this entry, if you think you've got something to say please send me an email at wpram@wpram.com.