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

8 Great Netcat (nc) unix commands

Netcat or nc (the command) is a networking utility for debugging and investigating a network, typically by creating and utilizing raw TCP/IP connections.  Known as “The Swiss Army Knife for TCP/IP”, nc is used to read or write to network connections using TCP or UDP. It’s raw features include: Outbound or inbound connections, TCP or […]

Installing an Intrusion Detection System (IDS) and Reporting Interface

An intrusion detection system (IDS) can perform log analysis, check file integrity, monitor policy changes, and keep an eye out for rootkit installations and alert you when a threat is first suspected. The IDS that I chose for my host was OSSES HIDS, an open source host-based Intrusion Detection System offered by Trend Micro. Here’s how I installed OSSEC on my hosted Linux VPS and Splunk on a local Windows machine to monitor.

Pocket Legends Archer Build Guide

I found this great game that’s similar to World of Warcraft, is cheap, and playable on my Android mobile device and my PC (plays in the Google Chrome browser). The graphics are great and comparable to World of Warcraft graphics except the world is somewhat limited (imagine World of Warcraft dungeons with walls limiting the area you can travel in). The performance on my Droid Bionic and in the Google Chrome browser is very impressive too.