Using the clipboard effectively – “Held der Kommandozeile”

Every now and then even the über-geek can’t avoid the use of non-command-line-tools. Currently I am doing a bit of production support work, so tail, grep, and awk are my friends. However people expect emails, excel spreadsheets, and similar stuff. So what to do? Well use the best of both worlds pipe your output into the clipboard and vice versa. Here is how it works for different platforms:

Cygwin

If you are a software developer or any other serious user of computing gear on windows get cygwin!

ls | putclip # Will copy the output of ls to the clipboard getclip | grep "ERROR 500" # Will grep on the contents of the clipboard

OSX

ls | pbcopy # Will copy the output of ls to the clipboard pbpaste | grep "ERROR 500" # Will grep on the contents of the clipboard

Linux

ls | xsel --clipboard # Will copy the output of ls to the clipboard xsel --clipboard | grep "ERROR 500" # Will grep on the contents of the clipboard
Alternatively you might want to try xclip.

QuickSilver

And while we are at it, if you are a QuickSilver user you should have a look at the qs commandline tool, which lets you pipe contents into qs or open qs on files.
qs mylovelyfile.ext # opens quicksilver on a file (useful for sending it by mail)

And of course I shamelessly stole that stuff from all over the place, e.g. there.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.