pbcopy / pbpaste in OS X

I came across a nifty utility in OS X that allows you to copy / paste data to/from the clipboard without having to select text and command+c/command+v

Michael-MacBook-Pro:~ (michael)> echo foo | pbcopy

Michael-MacBook-Pro:~ (michael)> pbpaste foo

Thats kind of neat.  What about connecting to a remote machine, executing some command, and then having that output in the clipboard of your local machine?

Michael-MacBook-Pro:~ (michael)> ssh somehost.com uptime | pbcopy

Michael-MacBook-Pro:~ (michael)> pbpaste 5:26pm  up 64 day(s),  8:30,  4 users,  load average: 0.04, 0.04, 0.04

This article was posted by Matty on 2009-02-13 13:34:00 -0400 -0400