summaryrefslogtreecommitdiff
path: root/old/published/Webmonkey/Monkey_Bites/2006/12.11.06/Fri/unix-tip.txt
blob: c8d5ad46868939def6e284c0e0ae51099bdeb88d (plain)
1
I find myself spending an increasing amount of time on the command line these days, but without a strong background in Unix, I sometimes feel I'm missing out on lots of time saving tips and tricks.

This morning I found a link on Digg to a handy [list of Unix shell tips and tricks][1] that has already been saving me some time. Michael Stutz over at IBM's Developer Works writes:

>When you use a system often, you tend to fall into set usage patterns. Sometimes, you do not start the habit of doing things in the best possible way. Sometimes, you even pick up bad practices that lead to clutter and clumsiness. One of the best ways to correct such inadequacies is to conscientiously pick up good habits that counteract them. This article suggests 10 UNIX command-line habits worth picking up -- good habits that help you break many common usage foibles and make you more productive at the command line in the process.

One of my biggest annoyances in the shell is when I try to cd to a directory and only then discover that I haven't created that directory yet. This simple line from the article solves that issue by creating the directory if it doesn't exist:

	cd tmp/a/b/c || mkdir -p tmp/a/b/c

I suppose if I were smarter I would have thought of that myself, but that's what the article is good at pointing out, tricks that, if you had the time to stop and think about them for a while, you'd probably solve yourself. But who has that time when there's work to be done?

[1]: http://www-128.ibm.com/developerworks/aix/library/au-badunixhabits.html "Unis tips and tricks"