News Archive
PhpRiot Newsletter
Your Email Address:

More information

Be Lazy

Note: This article was originally published at Planet PHP on 21 April 1540.
Planet PHP

The other day, I went to help a co-worker set up his laptop. When teaching new topics, I'm a big fan of active participation, letting the other person drive as a means to better understanding. So, during the setup, I explained what we were doing, what changes we were making and why, but insisted he make the actual changes on his system.

Watching him work, it quickly became apparent that--while he knew what he was doing--he wasn't efficient. Using the tools on his laptop was onerous; he fought the system, taking the long way each time to achieve the desired results, but at the cost of lost time for both of us. As I was watching him, I wished he were more lazy.

Wait. Lazy? Well, sure.

Laziness is the first great virtue of a programmer:

aoThe quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer.a

-a Larry Wall

Fortunately, laziness isn't just for programmers; it's for all who work and take pride in their accomplishements, and with computers, it's possible to be lazy (and efficient!) with just a little effort.

And, look at all the ways you can be lazy!

App launchers

Moving hands away from the keyboard, or away from their default position if you use a secondary input device consistently, inherently creates inefficiencies. Use an app launcher that you can customize. Four or five keystrokes is all I need to open just about any app on my system: two to open the launcher, one or two to select the app or file, and enter to open it. You can also use app launchers to set up scripts and run workflows.

On OSX, options include Alfred, Launchbar, and Quicksilver.

On Linux, options include Gnome Launch Box, Gnome Do, and Launchy.

On Windows, options include Skylight and Launchy.

Launchy also lets you use Python to extend its functionality, so you can automate common work patterns.

Or, if you're on OS X, use the highly-underrated Automator workflows for tasks on your system. You can have your workflows triggered manually or automatically. An example could be instead of the default action to import all photos into iPhoto whenever you mount an SD card, you could have all images post to a private folder on OpenPhoto and tag them with the date.

Befriend the command line

Not all workflows, however, need be triggered from an app launcher or automatically. Using the command line, you can trigger most apps to run just the way you want. While some developers may roll their eyes, not everyone uses the command line. Befriending the command line is the best form of laziness.

If you're on a Unix platforma-ayes, that includes OS Xa-athese twelve commands will get you going: cd, cp, less, which, ls, rm, pwd, cat, find, grep, !!, and !$.

Want to execute the last command again?


Want to repeat a command you typed in a while ago?


Want to go to the beginning of a line?


Want to go to the end to edit the last argument?


Want to switch back to your previous directory?

cd -

Want to look through your history to find the command you ran a while ago?


My personal favorites are pushd and popd, with dirs to tell me where I am.

pushd with an argument will add the current directory (pwd) onto the directories stack (listed with dirs) and change the working directory to the one specified by the argument:

% pwd /Users/kitt % pushd ~/work/projects/web-advent ~/work/projects/web-advent ~ % pushd ~/work ~/work ~/work/projects/web-advent ~ % dirs -v 0 ~/work 1 ~/work/projects/web-advent 2 ~

Truncated by Planet PHP, read more at the original (another 4292 bytes)