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

Computer built into the desk

A Dutch man built this and posted it on tweakers.net (a Dutch website but translates to English pretty good using Google Chrome). He took a gaming computer system that he had and rather than change out the case, built a desk around it. He mocked up the design using Google Sketch, had his friend weld the aluminum frame and desk, installed thick glass as the desk top, and assembled the computer hardware into the desk frame. I believe the cooling system is in the drawer section to the right.

Common Mysql commands, queries, and administrative functions

Gotta love the mysql database.  Here is a list of common mysql commands and syntax that you will use most often. To login (from unix shell) use -h only if needed. # [mysql dir]/bin/mysql -h hostname -u root -p Create a database on the sql server. mysql> create database [databasename]; List all databases on the […]