How to command the command line?

Making your computer do what you want provides great joy, but it requires skills. Especially it requires you to learn programming which can be a daunting task. Writing short commands, so called one-liners, on the other hand is much easier.

Especially if you have the right examples to get started.

Perl has been known as one of the most powerful programming languages, and probably the most flexible one.

Perl One-liners book cover

The book Perl One-Liners written by Peteris Krumins and published by No Starch Press includes a nice set of examples and explanations. You can either copy the examples and use them, or you can learn from them and build your own one-liners.

The examples are grouped by types of tasks. Some of the examples work on text files.

These include task adding and removing spaces, dealing with empty rows, or numbering and filtering rows. Some of the examples provide reports (like summing numbers that appear in a file), others will change the files. For example, replacing one string by another. Even if it requires calculations.

There are also examples that are not processing files. For example printing out the date and the time in Greenwich. The example calculating factorial shows how can you use the all powerful modules of Perl, without writing a full script.

Many of the examples use Regexes and throughout the book you get a gentle taste of this powerful language. The knowledge you gain can then be applied in the Perl one-liners and in many other places in your computer.

By reading this book, you can make a step towards becoming the local computer wizard, even without learning how to program.

Just don't be surprised if this drags you into learning more Perl, and eventually programming in Perl. After all, one-liners have been know to be the gateway drug to Perl programming.

Published on 2013-11-22 by Gabor Szabo
Python, JavaScript, Node.js, Ruby, and more.

Twitter RSS feed