Skip to content

Command line clipboard manipulation in Mac OS X

I wanted a good utility to manipulate the system clipboard from the bash shell. Turns out OS X has this really cool ability built-in. Two commands, pbcopy (copy TO clipboard) and pbpaste (paste FROM clipboard) do the job admirably. So this post was typed in good old Vim and saved. After that, cat blog.txt | pbcopy and I was able to easily paste it into wordpress.

Although iTerm has the ability to copy to the clipboard with selected text and Cmd+C, this inserts linebreaks in paragraphs in a nasty fashion.

Apparently, it’s reasonably simple to have this ability in KDE as well, or so this page suggests. Anyone know how to do this under Gnome?

[Update: Here’s a python script to achieve this – works in Ubuntu and I guess, should work anywhere]

Post a Comment

Your email is never published nor shared.