Monday, November 1, 2010

mkdir -p

To create the hierarchy of directory we can use the mkdir command with the -p option. For eg. check the below mentioned directory structure we have three different level of directories.

os
|-- linux
| |-- debian
| |-- fedora
| `-- ubuntu
`-- unix
|-- aix
|-- bsd
`-- mac

The command to create the above mentioned directory structure as follows.

$ mkdir -p os/{linux/{debian,fedora,ubuntu},unix/{aix,bsd,mac}}

1 comment:

Unknown said...

Your example uses shell specific syntax. It should be mentioned, imo.

Cool example though :)