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]


    Not forever, due to path length restrictions.

Join the discussion!

Trending Stories Right Now