Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
User Commands (m - o) mkdir(1)
NAME
mkdir - Makes a directory
SYNOPSIS
mkdir [-m mode][-p] directory ...
The mkdir command creates new directories with read, write, and execute permissions based
upon the permissions established by the umask setting.
FLAGS
-m mode Sets the file permissions to mode, after creating the specified directory. The mode
argument can be either an absolute mode string or a symbolic mode string as defined
for chmod. In the latter case, use only 9 protection bits in the mode argument, because
the set-user-ID, set-group-ID, and sticky bits are ignored.
In symbolic mode strings, the operation characters + and - are interpreted relative to an
assumed initial mode of a=rwx;A+ adds permissions to the default mode, whereas a -
deletes permissions from the default mode.
-p Creates intermediate directories as necessary; otherwise, the full pathname prefixto
directory must already exist. Note that mkdir requires write permission in the parent
directory for users other than root.
For each directory argument that does not name an existing directory, effects
equivalent to those caused by the following command occur:
mkdir -p -m $(umask -S),u+wx $(dirname directory)&&
mkdir [-m mode] directory
[-m mode] represents the flag supplied to the original invocation of mkdir, if any.
Each component of directory that does not name an existing directory is created with
mode 777, modified by the current file mode creation mask (umask). The equivalent
of chmod u+wx is performed on each component to ensure that mkdir can create
lower directories regardless of the setting of umask.
Each component of directory that names an existing directory is ignored without error,
except for the last component. If an intermediate pathname component exists, but per-
missions are set to prevent writing or searching, mkdir fails and returns an error mes-
sage.
The mode argument does not apply to any intermediate directories created when the -p
flag is specified.
DESCRIPTION
The mkdir command also creates the standard entries . (dot), for the directory itself, and .. (dot
dot), for its parent.
The value of the bitwise inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO is used as the
mode argument. (If the -m flag is specified, the mode argument overrides this default.)
EXAMPLES
1. To create a new directory called test,enter:
mkdir test
2. To set file permissions for new directory test in absolute mode, enter:
mkdir -m 444 test
3. To set file permissions for new directory test in symbolic mode, enter:
mkdir -m+rw test
527188-003 Hewlett-Packard Company 6−17