Mkdir

From LQWiki
Jump to: navigation, search

mkdir is the command used to create directories. The syntax is mkdir options dirname. The option -m specifies the mode (permissions) of the created directory and -p creates any parents - for instance, mkdir -p parent/child creates both directories.

Contrary to the misleading desktop metaphor, a directory is not a 'folder'. A paper folder contains paper files. A directory is a directory - it contains no files, but is itself a file that contains a list of names mapped to numbers which locate the files on disk.

A directory always contains at least the two entries '.' (which refers to itself) and '..' (which refers to its parent). Well, unless it is the root directory on its volume, in which case its '..' refers to itself, just as '.' does.

Many people are used to using md as the command to make directories, so it is often aliased.

  alias md=mkdir    # In bash, etc.
  alias md mkdir    # In tcsh, etc.

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: man page

Related Commands

  • link - Make hard links.
  • ln - Make hard or soft links
  • readlink - Make a canonical name.
  • rmdir - Remove empty directories.

See Also

External links

This article is a stub and needs to be finished. Plunge forward and help it grow!