- Mkdir
The mkdir (make directory) command in the
Unix ,DOS ,OS/2 andMicrosoft Windows operating system s is used to make a new directory. In DOS, OS/2 and Windows the command is often abbreviated to md.Usage
Normal usage is as straightforward as follows:
Where name_of_directory is the name of the directory one wants to create. When typed as above (ie. normal usage), the new directory would be created within the current directory. On Unix, multiple directories can be specified, and mkdir will try to create all of them.
Options
On Unix-like operating systems, mkdir takes options. Three of the most common options are:
* -p: will also create all directories leading up to the given directory that do not exist already. If the given directory already exists, ignore the error.
* -v: display each directory that mkdir creates. Most often used with -p.
* -m: specify the octal permissions of directories created by mkdir.-p is most often used when using mkdir to build up complex directory hierarchies, in case a necessary directory is missing or already there. -m is commonly used to lock down temporary directories used by shell scripts.An example of -p in action is:
If /tmp/a exists but /tmp/a/b does not, mkdir will create /tmp/a/b before creating /tmp/a/b/c.
History
In early versions of Unix (4.1BSD, early versions of
System V ) this command had to besetuid root as the kernel didn't have a mkdir()syscall . Instead it made the directory withmknod () and linked in the . and .. directory entries manually.ee also
*
Find - The find command coupled with mkdir can be used to only recreate a directory structure (without files).
*List of Unix programs
*List of DOS commands References
* [http://technet.microsoft.com/en-us/library/bb490930.aspx Microsoft TechNet Mkdir article]
*man|cu|mkdir|SUS|make directories
Wikimedia Foundation. 2010.