NAME
mkdir —
create directory
SYNOPSIS
mkdir |
[-pv] [-m
mode]
[-Z|--context[=MAC]]
directory… |
DESCRIPTION
Creates the specified directories with mode
a=rwx - umask.
With -p, creates all leading directories,
too, with the permission bits of u=wx +
~umask. This ensures the final
directory can be created, regardless of ill-advised
umasks.
OPTIONS
-p,--parents- Create all parents of the specified directories as well, and ignore directories that already exist.
-v,--verbose- Write which directories were created to the standard output stream.
-m,--mode=mode- chmod(1)-style mode to create final directories as.
-Z,--context- Create directories with the default SELinux contexts for their paths. Ignored without SELinux.
--context=MAC- Create directories with SELinux context set to MAC. Ignored (diagnostic issued) without SELinux.
EXIT STATUS
1 if a
directory (or its parent with
-p) couldn't be created, except for when it's
because of EEXIST, the path is a directory, and
-p was specified.
SEE ALSO
STANDARDS
Conforms to IEEE Std 1003.1-2024
(“POSIX.1”). --context and
-v are extensions, also present on the GNU
system.
HISTORY
Appears in the first edition of the UNIX Programmer's Manual as mkdir(I):
NAMEmkdir -- make a directorySYNOPSISmkdir dirname
Second and later editions fix the bugs, note the mode being
17 (read+write owner+non-owner), and expand the
SYNOPSIS to
mkdir dirname ...AT&T System V Release 3
UNIX adds -m octal and
-p (with parents in the same mode as the
destination). 4.3BSD-Reno adds
-p (with parents as 777 -
umask).
IEEE Std 1003.2-1992
(“POSIX.2”) specifies -mp in
their current form, and such they appear in
4.4BSD-Lite2.