make a directory
mkdir [ -ep ] [ -m mode ]
mkdir creates the directories named in
dirname. Their permissions are initially set to 777
(possibly altered by
Creation of a directory requires write permission in the parent
When a directory is created, the standard entries (for example, the
files ``.'', for the directory itself, and ``..'', for
its parent) are made automatically. mkdir cannot create
these entries by name.
The user and group IDs of a newly created directory are
set to the real user and group IDs of the creating process
unless the set group ID (SGID) bit is set on the
current directory (see
If a directory is created in a directory that has the SGID
bit set, its group ID is set to that of the directory.
Directories inherit the SGID bit setting of the parent
directory in which they are created.
mkdir accepts the following options:
For historical compatibility, mkdir changes the ownership
of the new directory to the real user ID (RUID)
and the real group ID (RGID). The -e
option says to use the effective user ID (EUID)
and effective group ID (EGID) instead.
This option allows users to specify the mode to be used
for new directories. Choices for modes can be found in
With this option, mkdir creates dirname by
creating all the non-existing parent directories first. Any
intermediate directories that do not exist are created with mode 777
altered by umask. However, to ensure that mkdir
does not fail, the user execute and write permissions are always
mkdir returns 0 if all directories given in the command
line were created successfully; otherwise, it prints a diagnostic
and returns a non-zero value.
cannot make directory: dirname
The directory dirname cannot be created.
invalid mode: mode
The permissions specified by mode are invalid.
To create newdir inside the current directory:
To create the nested directory hierarchy newdir/subdir
inside the current directory, with the mode set so that only the
owner has read, write and execute permissions:
mkdir -p -m700 newdir/subdir
mkdir is conformant with:
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
A version of mkdir
that can handle files greater than 2GB
is available in /u95/bin. See
for more information.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005