[PLUG] OS X coolness: pbcopy and alpine

Paul Mullen pm at nellump.net
Tue Sep 3 18:44:53 UTC 2013


On Tue, Sep 03, 2013 at 11:18:40AM -0700, Paul Heinlein wrote:
> One of the neatest command-line tools in OS X is pbcopy (aka
> Pasteboard Copy), which allows you to pipe stuff into the copy/paste
> buffer. Its output counterpart is pbpaste.
> 
> So pbcopy allows you do to cool stuff like
> 
>   grep thisfile.txt | awk '{neat operation}' | pbcopy
> 
> Then you can paste it anywhere.

'xclip' on Linux (and presumably other Unix-like systems) works
similarly.  It combines both setting and getting into one command,
though.  From the README:

    Copy your uptime into the selection for pasting:
    uptime | xclip
    
    Copy your password file for pasting:
    xclip /etc/passwd
    
    Save some text you have Edit | Copied in a web browser:
    xclip -o -sel clip > webpage.txt
    
    Open a URL selected in an email client
    mozilla `xclip -o`
    
    Copy XA_PRIMARY to XA_CLIPBOARD
    xclip -o | xclip -sel clip

Tools like these are very handy for CLI junkies living in a GUI world.


-- 
Paul



More information about the PLUG mailing list