ArticleslgStudy

science

Mkdir

Mkdir is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Mkdir rather than just read about it. In short: The mkdir (make directory) command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell and in the PHP scripting language.

Mkdir — main illustration
Mkdir — illustration

Key takeaways

  • Mkdir belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Mkdir to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Mkdir from memory before moving on to harder problems.

Reference excerpt

The mkdir (make directory) command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell 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. MetaComCo TRIPOS and AmigaDOS provide a similar MakeDir command to create new directories. The numerical computing environments MATLAB and GNU Octave include an mkdir function with similar functionality.

History 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. Digital Research DR DOS 6.0 and Datalight ROM-DOS also include an implementation of the md and mkdir commands. The version of mkdir bundled in GNU coreutils was written by David MacKenzie. It is also available in the open source MS-DOS emulator DOSBox and in KolibriOS.

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 (i.e. normal usage), the new directory would be created within the current directory. On Unix and Windows (with Command extensions enabled, the default), multiple directories can be specified, and mkdir will try to create all of them.

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

-p (--parents): parents or path, will also create all directories leading up to the given directory that do not exist already. For example, mkdir -p a/b will create directory a if it doesn't exist, then will create directory b inside directory a. If the given directory already exists, ignore the error. -m (--mode): mode, 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.

Examples 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. And an even more powerful command, creating a full tree at once (this however is a Shell extension, nothing mkdir does itself):

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

This will create:

See also Filesystem Hierarchy Standard GNU Core Utilities 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

Further reading Cooper, Jim (2001). Special Edition Using MS-DOS 6.22, Third Edition. Que Publishing. ISBN 978-0789725738. Kathy Ivens; Brian Proffit (1993). OS/2 Inside & Out. Osborne McGraw-Hill. ISBN 978-0078818714. Frisch, Æleen (2001). Windows 2000 Commands Pocket Reference. O'Reilly. ISBN 978-0-596-00148-3. Barrett, Daniel J. (2012). Macintosh Terminal Pocket Guide: Take Command of Your Mac. O'Reilly. ISBN 978-1449328986.

External links

Microsoft TechNet Mkdir article mkdir: make directories – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group mkdir(1) – Plan 9 Programmer's Manual, Volume 1 mkdir(1) – Inferno General commands Manual

Illustrations

Mkdir illustration
Mkdir: The ReactOS mkdir command
The ReactOS mkdir command

Worked examples

Example 1 — a first encounter with Mkdir

Start with the simplest possible case. Write down what Mkdir claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Mkdir before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Mkdir ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Mkdir

In research
Mkdir appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Mkdir in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Mkdir is common in secondary-school and first-year university syllabi. It links to neighbouring topics IBM i Qshell commands, Inferno (operating system) commands, Internal DOS commands, so understanding it makes those chapters shorter.
In everyday life
Look for Mkdir outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Mkdir” →

How to study Mkdir in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Mkdir means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Mkdir out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Mkdir in simple terms?

The mkdir (make directory) command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell and in the PHP scripting language.

Why does Mkdir matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Mkdir?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Mkdir.

Tags

  • IBM i Qshell commands
  • Inferno (operating system) commands
  • Internal DOS commands
  • MSX-DOS commands
  • OS/2 commands
  • Plan 9 commands
  • ReactOS commands
  • Unix SUS2008 utilities
  • Windows administration
  • Windows commands

Keep exploring