Developer(s) | Various open-source and commercial developers |
---|---|
Written in | python3 |
Operating system | Unix, Unix-like, Plan 9, Inferno, DOS, MSX-DOS, FlexOS, OS/2, Windows, ReactOS, KolibriOS |
Platform | Cross-platform |
Type | Command |
License | GNU coreutils: GPLv3+ MS-DOS, Plan 9: MIT FreeDOS: GPLv2+ ReactOS: GPLv2 |
The mkdir
(make directory) 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]
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]
Normal usage is as straightforward as follows:
mkdirname_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.
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.
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-ptmpdir/{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
The cd
command, also known as chdir
, is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.
In computing, dir
(directory) is a command in various computer operating systems used for computer file and directory listing. It is one of the basic commands to help navigate the file system. The command is usually implemented as an internal command in the command-line interpreter (shell). On some systems, a more graphical representation of the directory structure can be displayed using the tree
command.
In Unix-like and some other operating systems, the pwd
command writes the full pathname of the current working directory to the standard output.
In computing, rmdir
is a command which will remove an empty directory on various operating systems.
In computing, touch
is a command used to update the access date and/or modification date of a computer file or directory. It is included in Unix and Unix-like operating systems, TSC's FLEX, Digital Research/Novell DR DOS, the AROS shell, the Microware OS-9 shell, and ReactOS. The command is also available for FreeDOS and Microsoft Windows.
In computing, echo
is a command that outputs the strings that are passed to it as arguments. It is a command available in various operating system shells and typically used in shell scripts and batch files to output status text to the screen or a computer file, or as a source part of a pipeline.
In computing, exit
is a command used in many operating system command-line shells and scripting languages.
In computing, more
is a command to view the contents of a text file one screen at a time. It is available on Unix and Unix-like systems, DOS, Digital Research FlexOS, IBM/Toshiba 4690 OS, IBM OS/2, Microsoft Windows and ReactOS. Programs of this sort are called pagers. more
is a very basic pager, originally allowing only forward navigation through a file, though newer implementations do allow for limited backward movement.
In computing, sleep is a command in Unix, Unix-like and other operating systems that suspends program execution for a specified time.
In computing, tree
is a recursive directory listing command or program that produces a depth-indented listing of files. Originating in PC- and MS-DOS, it is found in Digital Research FlexOS, IBM/Toshiba 4690 OS, PTS-DOS, FreeDOS, IBM OS/2, Microsoft Windows, and ReactOS. A version for Unix and Unix-like systems is also available.
In computing, ATTRIB
is a command in Intel ISIS-II, DOS, IBM OS/2, Microsoft Windows and ReactOS that allows the user to change various characteristics, or "attributes" of a computer file or directory. The command is also available in the EFI shell.
In computing, move
is a command in various command-line interpreters (shells) such as COMMAND.COM
, cmd.exe
, 4DOS/4NT, and PowerShell. It is used to move one or more files or directories from one place to another. The original file is deleted, and the new file may have the same or a different name. The command is analogous to the Unix mv
command and to the OpenVOS move_file
and move_dir
commands.
In computing, ren
is a command in various command-line interpreters (shells) such as COMMAND.COM
, cmd.exe
, 4DOS, 4NT and Windows PowerShell. It is used to rename computer files and in some implementations also directories. It is analogous to the Unix mv
command. However, unlike mv
, ren
cannot be used to move files, as a new directory for the destination file may not be used. Alternatively, move
may be used if available. On versions of MS-DOS that do not support the move
command, the user would simply copy the file to a new destination, and then delete the original file. A notable exception to this rule is DOSBox, in which ren
may be used to move a file, since move
is not supported.
In computing, del
is a command in command-line interpreters (shells) such as COMMAND.COM
, cmd.exe
, 4DOS, NDOS, 4OS2, 4NT and Windows PowerShell. It is used to delete one or more files or directories from a file system.
In computing, ver
is a command in various command-line interpreters (shells) such as COMMAND.COM
, cmd.exe
and 4DOS/4NT. It prints the name and version of the operating system, the command shell, or in some implementations the version of other commands. It is roughly equivalent to the Unix command uname
.
In some operating systems, vol
is a command within the command-line interpreters (shells) such as COMMAND.COM
and cmd.exe
. It is used to display the volume label and volume serial number of a logical drive, such as a hard disk partition or a floppy disk, if they exist.
In computing, help
is a command in various command line shells such as COMMAND.COM
, cmd.exe
, Bash, qshell, 4DOS/4NT, Windows PowerShell, Singularity shell, Python, MATLAB and GNU Octave. It provides online information about available commands and the shell environment.
In computing, copy
is a command in various operating systems. The command copies computer files from one directory to another.
In computing, TIME is a command in DEC RT-11, DOS, IBM OS/2, Microsoft Windows and a number of other operating systems that is used to display and set the current system time. It is included in command-line interpreters (shells) such as COMMAND.COM
, cmd.exe
, 4DOS, 4OS2 and 4NT.
In computing, format
is a command-line utility that carries out disk formatting. It is a component of various operating systems, including 86-DOS, MS-DOS, IBM PC DOS and OS/2, Microsoft Windows and ReactOS.