|HP-UX Reference > M
HP-UX 11i Version 3: February 2007
mkdir — make a directory
mkdir creates specified directories in mode 0777 (possibly altered by umask unless specified otherwise by a -m mode option (see umask(1)). Standard entries, . (for the directory itself) and .. (for its parent) are created automatically. If dirname already exists, mkdir exits with a diagnostic message, and the directory is not changed.
mkdir recognizes the following command-line options:
Only LINK_MAX subdirectories can be created (see limits(5)).
Access Control Lists - JFS File Systems Only
If the parent directory has an access control list (ACL, see aclv(5)), and that ACL contains default entries, an ACL is created for the new directory, and the parent directory's default entries are applied to the new directory's ACL, both as regular entries and as default entries.
For information about the UNIX standard environment, see standards(5).
LANG provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the default value of "C" (see lang(5)) is used. If any of the internationalization variables contains an invalid setting, mkdir will behave as if all internationalization variables are set to C. See environ(5).
LC_ALL If set to a non-empty string value, overrides the values of all the other internationalization variables.
LC_CTYPE determines the interpretation of text as single and/or multi-byte characters, the classification of characters as printable, and the characters matched by character class expressions in regular expressions.
LC_MESSAGES determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.
NLSPATH determines the location of message catalogues for the processing of LC_MESSAGES.
mkdir returns exit code 0 if all directories were created successfully. Otherwise, it prints a diagnostic and returns non-zero.
mkdir returns exit code 0 if the -p option was specified, and all the specified directories now exist. If any of the intermediate directories do not have search or write permission (with the -p option), mkdir prints a diagnostic and returns non-zero.
Create directory gem beneath existing directory raw in the current directory:
Create directory path raw/gem/diamond underneath the current directory and set permissions on directory diamond to read-only for all users (a=r):
mkdir -p -m "a=r" raw/gem/diamond
which is equivalent to (see chmod(1)):
mkdir -p -m 444 raw/gem/diamond
If directories raw or raw and gem already exist, only the missing directories in the specified path are created.