MKDIR(1) | User Commands | MKDIR(1) |
mkdir - make directories
/usr/bin/mkdir [-m mode] [-p] dir...
mkdir [-p] [-m mode] dir...
The mkdir command creates the named directories in mode 777 (possibly altered by the file mode creation mask umask(1)).
Standard entries in a directory (for instance, the files ".", for the directory itself, and "..", for its parent) are made automatically. mkdir cannot create these entries by name. Creation of a directory requires write permission in the parent directory.
The owner-ID and group-ID of the new directories are set to the process's effective user-ID and group-ID, respectively. mkdir calls the mkdir(2) system call.
To change the setgid bit on a newly created directory, you must use chmod g+s or chmod g-s after executing mkdir.
The setgid bit setting is inherited from the parent directory.
The mkdir built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when mkdir is executed without a pathname prefix and the pathname search finds a /bin/mkdir or /usr/bin/mkdir executable. mkdir creates one or more directories. By default, the mode of created directories is a=rwx minus the bits set in umask(1).
The following options are supported by /usr/bin/mkdir:
-m mode
-p
The following options are supported by the mkdir built-in in ksh93:
-m mode
--mode=mode
-p
--parents
mkdir -p -m $(umask -S),u+wx \
$(dirname dir) && mkdir [-m mode] dir
Where the -m mode option represents that option supplied to the original invocation of mkdir, if any. Each dir operand that names an existing directory is ignored without error.
The following operand is supported:
dir
See largefile(7) for the description of the behavior of mkdir when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
Example 1 Using mkdir
The following example:
example% mkdir -p ltr/jd/jan
creates the subdirectory structure ltr/jd/jan.
See environ(7) for descriptions of the following environment variables that affect the execution of mkdir: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following exit values are returned:
0
>0
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
CSI | Enabled |
Interface Stability | Committed |
Standard | See standards(7). |
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | See below. |
Standard | See standards(7). |
The ksh93 built-in binding to /bin and /usr/bin is Volatile. The built-in interfaces are Uncommitted.
chmod(1), ksh93(1), rm(1), sh(1), umask(1), Intro(2), mkdir(2), attributes(7), environ(7), largefile(7), standards(7)
November 2, 2007 | OmniOS |