Let's say you want to make a directory tree in Linux a few directories deep. You could do this:
greg@greg-laptop:~$ mkdir tst
greg@greg-laptop:~$ cd tst
greg@greg-laptop:~/tst$ mkdir tstdeeper
greg@greg-laptop:~/tst$ cd tstdeeper
greg@greg-laptop:~/tst/tstdeeper$ mkdir evendeeper
greg@greg-laptop:~/tst/tstdeeper$ cd evendeeper
greg@greg-laptop:~/tst/tstdeeper/evendeeper$
Or, you could be smart and do this:
greg@greg-laptop:~$ mkdir -p tst/tstdeeper/evendeeper
Notice the -p option.

Learn more about Charles Darwin and his work.
Looking for stuff about birds?
Lean more about lions

Comments
For the record, Windows does this magically -- without the need for -p.
Just saying.
Posted by: StuV | March 3, 2008 6:34 PM
On the other hand, windows doesn't let you use '?' or several other characters.
Posted by: kezdro | March 3, 2008 6:44 PM
Yet another major security hole in windows exposed!
Posted by: Greg Laden | March 3, 2008 7:19 PM
The other nice thing about -p is that it doesn't complain if the target exists. This makes it very useful in situations where you want to ensure a directory is there and you don't want to deal separately with the case where it is vs. the one where it isn't.
Posted by: Jeff Darcy | March 3, 2008 7:50 PM
Beware the power of xargs.
sed -e 's/\(.\)/\/\1/g' -e 's/^/words/' /usr/dict/words | xargs mkdir -p
Posted by: rpenner | March 3, 2008 8:02 PM