Create New Directories And Subdirectories With One Terminal Command

Create New Directories And Subdirectories With One Terminal Command

If you know your terminal basics, you know that mkdir creates directories, but it can do much more. If you add the -p flag, you can create a directory with subdirectories in a single command and save yourself the trouble of quite a bit of extra typing.

Here’s an example:

mkdir -p parentdir/childdir/etc

That command will create a new directory called parentdir with a subdirectory of childdir and another subdirectory inside of childdir called etc. You can make the chain go on forever if you want. Just type out the path you want to create, hit enter, and you’ll have it with plenty of typing time saved.

6 Mac OS X Terminal Tips [Colmjude]


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


One response to “Create New Directories And Subdirectories With One Terminal Command”