Five Shell One Liners

Perhaps I’m just old fashioned and pining for the old days. Or perhaps I’m anticipating the time when I can finally wave my cane at all those pesky kids. Whatever the case, I do believe that avoiding the command line—or worse, disparaging it—is leaving a lot on the table.

Doug McIlroy’s original conception of hooking up programs as if there were a garden hose between them is a powerful and liberating idea and arguably one of the most important Unix innovations. You can see it in action in this video about Unix where Brian Kernighan pipes together some simple programs to build a spell checker or in the famous McIlroy rejoinder to Knuth on writing a word count program.

But you don’t even need the power of pipes to see the usefulness of the shell. Mirco has a short post that demonstrates 5 one line shell invocations to solve various problems. In a sense, they’re all trivial problems but try to imagine a better way of solving them—especially with a GUI program in your toolkit.

As far as I can see, these examples are semispecific to Bash and Linux. For example, the last example of negating a file specification doesn’t appear to work with the zshell (although I’m certain there’s an extension that makes it work) and the date example depends on the version of date you’re using. Still, they demonstrate how you can often use the shell to solve a simple problem quickly and easily.

This entry was posted in General and tagged , . Bookmark the permalink.