mkdir

mkdir

The mkdir (make directory) command in the Unix, DOS, OS/2 and Microsoft Windows operating systems is used to make a new directory. In DOS, OS/2 and Windows the command is often abbreviated to md.

Contents

Usage

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

Examples

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}

This will create:

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

History

In early versions of Unix (4.1BSD, 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.

See 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


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Mkdir — est une commande Unix permettant de créer des répertoires. mkdir est l abréviation de make directory (termes anglais signifiant « fabriquer répertoire »). Cette commande est également connue sous le nom md (make directory) sur d autres… …   Wikipédia en Français

  • mkdir — est une commande Unix permettant de créer des répertoires. mkdir est l abréviation de make directory (termes anglais signifiant « créer répertoire »). Cette commande est également connue sous le nom md (make directory) sur d autres… …   Wikipédia en Français

  • Mkdir — Тип программа для создания новых каталогов Разработчик Проект GNU Написана на C Операционная система Unix подобные Последняя версия 8.5 (23 апреля 2010) Лицензия …   Википедия

  • Mkdir — Saltar a navegación, búsqueda Captura de pantalla salida mkdir help mkdir es una orden del Sistema Operativo UNIX usada para crear un nuevo directorio del sistema de archivos. mkdir tiene su origen en las palabras make directory que significan… …   Wikipedia Español

  • mkdir — в операционной системе Unix команда для создания новой директории. Пример использования: mkdir имя директории Создание нескольких директорий : mkdir имя директории1 имя директории2 имя директории3 создаст папки: имя директории1, имя… …   Википедия

  • Mkdir — The mkdir (make directory) command in the Unix, DOS, OS/2 and Microsoft Windows operating systems is used to make a new directory. In DOS, OS/2 and Windows the command is often abbreviated to md.UsageNormal usage is as straightforward as… …   Wikipedia

  • mkdir — Captura de pantalla salida mkdir help. mkdir es una orden de los sistemas operativos UNIX, DOS, OS/2 y Microsoft Windows usada para crear un nuevo directorio o carpeta del sistema de archivos. mkdir tiene su origen en las palabras make directory… …   Wikipedia Español

  • Mkdir (Unix) — mkdir mkdir est une commande Unix permettant de créer des répertoires. mkdir est l abréviation de make directory (termes anglais signifiant « fabriquer répertoire »). Cette commande est également connue sous le nom md (make directory)… …   Wikipédia en Français

  • MKDIR — Make Directory (unter DOS) …   Acronyms

  • mkdir — ● ►en cde. ►CMDE make directory. Commande classique permettant de créer un répertoire. Sa variante mkdirhier permet de créer toute une hiérarchie de répertoire …   Dictionnaire d'informatique francophone

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”