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

20 Linux system monitoring tools to assist SysAdmins when herding cats

Need to monitor Linux server performance? Try these built-in commands and a few add-on tools. Most Linux distributions are equipped with tons of monitoring. These tools provide metrics which can be used to get information about system activities. You can use these tools to find the possible causes of a performance problem. The commands discussed […]

The Secret in the Bible book puzzle solution

The Secret in the Bible by Tony Bushby has quite a few factual errors and is more of an atheist “push my agenda” type of book rather than a historical review of the subject matter. There was one interesting aspect to the book though. It included a “puzzle” whereby each of the sixteen chapters contained a secret word that when put together in a sentence reveals ancient knowledge so secret, Bushby was not allowed to outright reveal them in his book for fear of some sort of extremely viscous retribution from someone (boy, have I got news for him).

IFTTT Remote trigger system ties all your “services” together

Iftt.com. It stands for (if this then that). It’s basically a “trigger”system that ties into tons of services including RSS, Dropbox, Evernote, Gmail, Youtube, Facebook, Twitter, general email, Flickr, LinkedIn, Last.fm, Read it Later (which I love), Wordpress, etc. It even has triggers for text messages, phone calls, stocks and bonds, and the weather.