Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 History  





2 Usage  



2.1  Options  





2.2  Examples  







3 See also  





4 References  





5 Further reading  





6 External links  














mkdir






العربية
Беларуская
Català
Čeština
Deutsch
Ελληνικά
Español
فارسی
Français

ि
Italiano
עברית

Magyar
Nederlands

Polski
Português
Română
Русский
Српски / srpski
Türkçe
Українська

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


mkdir
Developer(s)Various open-source and commercial developers
Written inpyhton3
Operating systemUnix, Unix-like, Plan 9, Inferno, DOS, MSX-DOS, FlexOS, OS/2, Windows, ReactOS, KolibriOS
PlatformCross-platform
TypeCommand
LicenseGNU coreutils: GPLv3+
MS-DOS, Plan 9: MIT
FreeDOS: GPLv2+
ReactOS: GPLv2

The mkdir (makedirectory) command in the Unix, DOS, DR FlexOS,[1] IBM OS/2,[2] Microsoft Windows, and ReactOS[3] operating systems is used to make a new directory. It is also available in the EFI shell[4] and in the PHP scripting language. In DOS, OS/2, Windows and ReactOS, the command is often abbreviated to md.

The command is analogous to the Stratus OpenVOS create_dir command.[5] MetaComCo TRIPOS and AmigaDOS provide a similar MakeDir command to create new directories.[6][7] The numerical computing environments MATLAB and GNU Octave include an mkdir function with similar functionality.[8][9]

History[edit]

In early versions of Unix (4.1BSD and early versions of System V), this command had to be setuid root as the kernel did not have an mkdir syscall. Instead, it made the directory with mknod and linked in the . and .. directory entries manually. The command is available in MS-DOS versions 2 and later.[10] Digital Research DR DOS 6.0[11] and Datalight ROM-DOS[12] also include an implementation of the md and mkdir commands.

The version of mkdir bundled in GNU coreutils was written by David MacKenzie.[13] It is also available in the open source MS-DOS emulator DOSBox and in KolibriOS.[14]

Usage[edit]

The ReactOS mkdir command

Normal usage is as straightforward as follows:

mkdir name_of_directory

where name_of_directory 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,[15] the default[16]), multiple directories can be specified, and mkdir will try to create all of them.

Options[edit]

On Unix-like operating systems, mkdir takes options. The options are:

-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.

Examples[edit]

An example of -p in action is:

mkdir -p /tmp/a/b/c

If/tmp/a exists but /tmp/a/b does not, mkdir will create /tmp/a/b before creating /tmp/a/b/c.

And an even more powerful command, creating a full tree at once (this however is a Shell extension, nothing mkdir does itself):

mkdir -p tmpdir/{trunk/sources/{includes,docs},branches,tags}

If one is using variables with mkdir in a bash script, POSIX `special' built-in command 'eval' would serve its purpose.

DOMAIN_NAME=includes,docs
eval "mkdir -p tmpdir/{trunk/sources/{${DOMAIN_NAME}},branches,tags}"

This will create:

          tmpdir
    ________|______
   |        |      |
branches   tags  trunk
                   |
                 sources
               ____|_____
              |          |
          includes     docs

See also[edit]

References[edit]

  1. ^ "Users guide" (PDF). bitsavers.org. Archived from the original (PDF) on 2019-09-25. Retrieved 2019-10-22.
  • ^ "JaTomes Help - OS/2 Commands". www.jatomes.com.
  • ^ "GitHub - reactos/reactos: A free Windows-compatible Operating System". October 22, 2019 – via GitHub.
  • ^ "EFI Shells and Scripting". Intel. Retrieved 2013-09-25.
  • ^ "Reference manual" (PDF). stratadoc.stratus.com. Retrieved 2019-10-22.
  • ^ "Introduction to Tripos" (PDF). Retrieved 2019-10-22.
  • ^ Rügheimer, Hannes; Spanik, Christian (October 22, 1988). AmigaDOS quick reference. Grand Rapids, Mi : Abacus. ISBN 9781557550491 – via Internet Archive.
  • ^ "Make new folder - MATLAB mkdir". www.mathworks.com.
  • ^ "Function Reference: mkdir". octave.sourceforge.io.
  • ^ Wolverton, Van (2003). Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition. Microsoft Press. ISBN 0-7356-1812-7.
  • ^ "DR DOS 6.0 User Guide Optimisation and Configuration Tips" (PDF). Archived from the original (PDF) on 2019-09-30. Retrieved 2019-08-13.
  • ^ "Datalight ROM-DOS User's Guide" (PDF). www.datalight.com.
  • ^ "mkdir(1): make directories - Linux man page". linux.die.net.
  • ^ "Shell - KolibriOS wiki". wiki.kolibrios.org.
  • ^ "Microsoft Windows XP - Mkdir". Microsoft. Archived from the original on July 22, 2016. Retrieved 25 October 2012.
  • ^ "Microsoft Windows XP - Cmd". Microsoft. Retrieved 25 October 2012.
  • Further reading[edit]

    External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Mkdir&oldid=1225067998"

    Categories: 
    Windows commands
    Unix SUS2008 utilities
    Plan 9 commands
    Inferno (operating system) commands
    Internal DOS commands
    MSX-DOS commands
    OS/2 commands
    ReactOS commands
    Windows administration
    IBM i Qshell commands
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
     



    This page was last edited on 22 May 2024, at 05:02 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki