Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Mkdir
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Directory creation command on various operating systems}} {{Lowercase|title=mkdir}} {{Infobox software | name = mkdir | logo = | screenshot = Mkdir terminal.png | screenshot size = | caption = The {{code|mkdir}} command | developer = Various [[open-source software|open-source]] and [[commercial software|commercial]] developers | released = | latest release version = | latest release date = | programming language = python3 | operating system = [[Unix]], [[Unix-like]], [[Plan 9 from Bell Labs|Plan 9]], [[Inferno (operating system)|Inferno]], [[DOS]], [[MSX-DOS]], [[FlexOS]], [[OS/2]], [[Microsoft Windows|Windows]], [[ReactOS]], [[KolibriOS]] | platform = [[Cross-platform]] | genre = [[Command (computing)|Command]] | license = [[GNU]] [[coreutils]]: [[GPLv3+]]<br />[[MS-DOS]], Plan 9: [[MIT License|MIT]]<br />[[FreeDOS]]: [[GPLv2+]]<br />[[ReactOS]]: [[GPLv2]] }} ('''m'''a'''k'''e '''dir'''ectory) [[command (computing)|command]] in the [[Unix]], [[DOS]], [[Digital Research|DR]] [[FlexOS]],<ref>{{cite web |url=http://www.bitsavers.org/pdf/digitalResearch/flexos/1073-2003_FlexOS_Users_Guide_V1.3_Nov86.pdf |title=Users guide |publisher=bitsavers.org |access-date=2019-10-22 |archive-date=2019-09-25 |archive-url=https://web.archive.org/web/20190925131719/http://bitsavers.org/pdf/digitalResearch/flexos/1073-2003_FlexOS_Users_Guide_V1.3_Nov86.pdf |url-status=dead }}</ref> [[IBM]] [[OS/2]],<ref>{{cite web|url=http://www.jatomes.com/Help/Os2Cmd.php#MD|title=JaTomes Help - OS/2 Commands|website=www.jatomes.com}}</ref> [[Microsoft Windows]], and [[ReactOS]]<ref>{{cite web|url=https://github.com/reactos/reactos|title=GitHub - reactos/reactos: A free Windows-compatible Operating System|date=October 22, 2019|via=GitHub}}</ref> [[operating system]]s is used to make a new [[directory (file systems)|directory]]. It is also available in the [[Unified Extensible Firmware Interface|EFI shell]]<ref name="EFI-Shells-and-Scripting">{{cite web | url = http://software.intel.com/en-us/articles/efi-shells-and-scripting/ | title = EFI Shells and Scripting | publisher = [[Intel]] | access-date = 2013-09-25 }}</ref> and in the [[PHP]] [[scripting language]]. In DOS, OS/2, Windows and ReactOS, the command is often abbreviated to <code>'''md'''</code>. The command is analogous to the [[Stratus Technologies|Stratus]] [[Stratus VOS|OpenVOS]] <code>create_dir</code> command.<ref>{{cite web|url=http://stratadoc.stratus.com/vos/19.1.0/r098-19/wwhelp/wwhimpl/common/html/r098-19.pdf |title=Reference manual |publisher=stratadoc.stratus.com |access-date=2019-10-22}}</ref> [[MetaComCo]] [[TRIPOS]] and [[AmigaDOS]] provide a similar <code>MakeDir</code> command to create new directories.<ref>{{cite web|url=https://www.pagetable.com/docs/amigados_tripos/tripos_manuals.pdf |title=Introduction to Tripos |access-date=2019-10-22}}</ref><ref>{{cite book|url=http://archive.org/details/1988-rugheimer-spanik-amigados-quick-reference|title=AmigaDOS quick reference|first1=Hannes|last1=Rügheimer|first2=Christian|last2=Spanik|date=October 22, 1988|publisher=Grand Rapids, Mi : Abacus|isbn=9781557550491|via=Internet Archive}}</ref> The [[numerical analysis|numerical computing]] environments [[MATLAB]] and [[GNU Octave]] include an <code>mkdir</code> function with similar functionality.<ref>{{cite web|url=https://www.mathworks.com/help/matlab/ref/mkdir.html|title=Make new folder - MATLAB mkdir|website=www.mathworks.com}}</ref><ref>{{cite web|url=https://octave.sourceforge.io/octave/function/mkdir.html|title=Function Reference: mkdir|website=octave.sourceforge.io}}</ref> ==History== In early versions of Unix ([[Berkeley Software Distribution|4.1BSD]] and early versions of [[System V]]), this command had to be [[setuid]] [[superuser|root]] as the [[kernel (operating system)|kernel]] did not have an <code>mkdir</code> [[syscall]]. Instead, it made the directory with <code>[[mknod]]</code> and linked in the <code>.</code> and <code>..</code> directory entries manually. The command is available in [[MS-DOS]] versions 2 and later.<ref name="RUNNINGMSDOS">{{Cite book|author-last=Wolverton|author-first=Van|title=Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition|date=2003|publisher=[[Microsoft Press]]|isbn=0-7356-1812-7}}</ref> [[Digital Research]] [[DR DOS 6.0]]<ref name="drdos6userguide">{{Cite web |url=https://www.4corn.co.uk/archive/docs/DR%20DOS%206.0%20User%20Guide-opt.pdf |title=DR DOS 6.0 User Guide Optimisation and Configuration Tips |access-date=2019-08-13 |archive-url=https://web.archive.org/web/20190930135943/http://www.4corn.co.uk/archive/docs/DR%20DOS%206.0%20User%20Guide-opt.pdf |archive-date=2019-09-30 |url-status=dead }}</ref> and [[Datalight]] [[ROM-DOS]]<ref>{{Cite web|url=https://www.datalight.com/assets/files/ROM-DOS_Users_Guide.pdf|title=Datalight ROM-DOS User's Guide|website=www.datalight.com}}</ref> also include an implementation of the {{code|md}} and {{code|mkdir}} commands. The version of <code>mkdir</code> bundled in [[GNU]] [[coreutils]] was written by David MacKenzie.<ref>{{cite web|url=https://linux.die.net/man/1/mkdir|title=mkdir(1): make directories - Linux man page|website=linux.die.net}}</ref> It is also available in the [[open source]] MS-DOS [[emulator]] [[DOSBox]] and in [[KolibriOS]].<ref>{{cite web|url=http://wiki.kolibrios.org/wiki/Shell|title=Shell - KolibriOS wiki|website=wiki.kolibrios.org}}</ref> ==Usage== [[File:ReactOS-0.4.13 mkdir command 667x434.png|thumb|300px|The [[ReactOS]] <code>mkdir</code> command]] Normal usage is as straightforward as follows: <syntaxhighlight lang="bash"> mkdir name_of_directory </syntaxhighlight> where <code>name_of_directory</code> is the name of the directory one wants to create. When typed as above (i.e. normal usage), the new directory would be created within the current directory. On Unix and Windows (with Command extensions enabled,<ref>{{cite web|url=http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/mkdir.mspx?mfr=true|title=Microsoft Windows XP - Mkdir|publisher=Microsoft|archive-url=https://web.archive.org/web/20160722020802/http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/mkdir.mspx?mfr=true|archive-date=July 22, 2016|access-date=25 October 2012}}</ref> the default<ref>{{cite web|title=Microsoft Windows XP - Cmd|url=http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true|publisher=Microsoft|access-date=25 October 2012}}</ref>), multiple directories can be specified, and <code>mkdir</code> will try to create all of them. ===Options=== On Unix-like operating systems, <code>mkdir</code> takes options. The options are: * <code>-p (--parents)</code>: ''parents'' or ''path'', will also create all directories leading up to the given directory that do not exist already. For example, <code>mkdir -p a/b</code> will create directory <code>a</code> if it doesn't exist, then will create directory <code>b</code> inside directory <code>a</code>. If the given directory already exists, ignore the error. * <code>-m (--mode)</code>: ''mode'', specify the [[File system permissions#Numeric notation|octal permissions]] of directories created by <code>mkdir</code> . <code>-p</code> is most often used when using <code>mkdir</code> to build up complex directory hierarchies, in case a necessary directory is missing or already there. <code>-m</code> is commonly used to lock down temporary directories used by [[shell script]]s. ===Examples=== An example of <code>-p</code> in action is: <syntaxhighlight lang="bash"> mkdir -p /tmp/a/b/c </syntaxhighlight> If <code>/tmp/a</code> exists but <code>/tmp/a/b</code> does not, <code>mkdir</code> will create <code>/tmp/a/b</code> before creating <code>/tmp/a/b/c</code>. And an even more powerful command, creating a full tree at once (this however is a [[shell (computing)|Shell]] extension, nothing mkdir does itself): <syntaxhighlight lang="bash"> mkdir -p tmpdir/{trunk/sources/{includes,docs},branches,tags} </syntaxhighlight> If one is using variables with mkdir in a bash script, [[POSIX]] `special' built-in command 'eval' would serve its purpose. <syntaxhighlight lang="bash"> DOMAIN_NAME=includes,docs eval "mkdir -p tmpdir/{trunk/sources/{${DOMAIN_NAME}},branches,tags}" </syntaxhighlight> This will create: <syntaxhighlight lang="text"> tmpdir ________|______ | | | branches tags trunk | sources ____|_____ | | includes docs </syntaxhighlight> ==See also== * [[Filesystem Hierarchy Standard]] * [[GNU Core Utilities]] * [[Find (Unix)|Find]] – The find command coupled with mkdir can be used to only recreate a directory structure (without files). * [[List of Unix commands]] * [[List of DOS commands]] ==References== {{Reflist}} ==Further reading== *{{Cite book|author-last=Cooper|author-first=Jim|title=Special Edition Using MS-DOS 6.22, Third Edition|date=2001|publisher=[[Que Publishing]]|isbn=978-0789725738}} *{{Cite book|author1=Kathy Ivens|author2=Brian Proffit|year=1993|title=OS/2 Inside & Out|publisher=[[Osborne McGraw-Hill]]|isbn=978-0078818714}} *{{Cite book|first=Æleen|last=Frisch|year=2001|title=Windows 2000 Commands Pocket Reference|publisher=[[O'Reilly Media|O'Reilly]]|isbn=978-0-596-00148-3}} *{{Cite book|first=Daniel J.|last=Barrett|year=2012|title=Macintosh Terminal Pocket Guide: Take Command of Your Mac|publisher=[[O'Reilly Media|O'Reilly]]|isbn=978-1449328986}} ==External links== {{Wikibooks|Guide to Windows Commands}} {{Wikibooks|Guide to Unix|Commands}} * [https://technet.microsoft.com/en-us/library/bb490930.aspx Microsoft TechNet Mkdir article] * {{man|cu|mkdir|SUS|make directories}} * {{man|1|mkdir|Plan 9}} * {{man|1|mkdir|Inferno}} {{Unix commands}} {{Plan 9 commands}} {{Core Utilities commands}} {{Windows commands}} [[Category:Unix SUS2008 utilities]] [[Category:Plan 9 commands]] [[Category:Inferno (operating system) commands]] [[Category:Internal DOS commands]] [[Category:MSX-DOS commands]] [[Category:OS/2 commands]] [[Category:ReactOS commands]] [[Category:Windows commands]] [[Category:Windows administration]] [[Category:IBM i Qshell commands]]
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:Core Utilities commands
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase
(
edit
)
Template:Man
(
edit
)
Template:Plan 9 commands
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Unix commands
(
edit
)
Template:Wikibooks
(
edit
)
Template:Windows commands
(
edit
)
Search
Search
Editing
Mkdir
Add topic