Create new directories and subdirectories in Unix using a single terminal command

It’s funny how programmers get in a "rut", using the same old coding habits and command line syntax for years on end.  I just found that you can create new directories and subdirectories with a single Unix mkdir command using the -p parm.

mkdir -p top_level_directory/child_directory/another_child_directory

And if you’re curious, this won’t work (I tried it):

mkdir -p onemoredir/../anotherdir

Goes to show you that we should follow the same advice we give the junior developers – "check the man page".

Leave a Reply

Related Post

The Speed of the Internet at Google (Googleplex)

Recently Google hosted a thread on Reddit where they answered questions from the general public. The question of Internet connection speed at Googleplex came up. To put things in perspective, the average connection in European countries is 12 Mb/s and 10 Mb/s in the United States. Personally, my connection with U-Verse is a blazing, or so I thought, 25 Mb/s. Google’s pipe is a mind blowing 523 Mb/s!

A homeless man and his dog

A homeless man and his dog

I ran across this powerful picture which lead me to a bit of research on the homeless problem. Although difficult to measure, it is estimated that between 2.3 and 3.5 million people will experience homelessness.

How to hide entertainment system wiring

I ran across this photo and thought it was brilliant. A common problem, what to do with the entertainment center wires, and this guy took a tack I had never thought of – just hide the wires in plain sight but bend them in such a manner that the represent the angular lines of a circuit board. In essences, he’s taken the ugly mess of wires and turned them into “art”.