mkdir(1) mkdir(1)
NAME
mkdir - make a directory
SYNOPSIS
mkdir [option ...] directory ...
DESCRIPTION
mkdir is used to create new directories.
mkdir automatically makes the following standard entries in the new
directory:
. (dot) for the directory itself
.. (dot dot) for the parent directory
To be able to use mkdir you have to have write permission in the
parent directory.
OPTIONS
No option specified:
mkdir creates the named directories in mode 777 [see chmod(1)],
modified by the current file-creation mode mask [see umask(1)].
-m mode
The access permissions specified in mode are used for the new
directory [see chmod(1)].
-p (parent) mkdir creates any non-existing parent directories that
are given in the path name of directory before creating the
directory itself. The parent directories get the standard access
permissions plus u+wx to grant the creation of subdirectories.
-- If directory begins with a dash (-), the end of the command-line
options must be marked with --.
directory
Name of the directory that you wish to create. You can also
create more than one directory at a time.
directory can be given either as a relative path name or as an
absolute path name.
The user ID and the group ID of the new directory are set to the
real user ID and real group ID of the calling process.
EXIT STATUS
0 If all directories given in the command line were made success-
fully.
>0 An error occurred. mkdir also prints an error message.
Page 1 Reliant UNIX 5.44 Printed 11/98
mkdir(1) mkdir(1)
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
Creating a new directory named letters in the directory
/home/sisyphus/general:
First you check which directory you are in. The default directory mode
is set to 777.
$ pwd
/home/sisyphus
Next you list the contents of this directory:
$ ls -l
total 145
-rw-r--r-- 1 sisyphus group1 5329 Nov 03 09:54 diff.rc.1
drwx--x--x 2 sisyphus group1 2589 Aug 03 15:08 general
.
.
.
drwxr----- 3 sisyphus group1 2340 Jun 11 15:35 lingua
drwx------ 2 sisyphus group1 3380 Oct 11 15:36 post
drwx--x--x 2 sisyphus group1 2080 Nov 04 16:08 proc
drwx------ 2 sisyphus group1 1560 Oct 11 15:36 screens
Then you create the new directory:
$ mkdir general/letters
Finally you check whether a directory named letters has been created:
$ cd general
$ ls -l
total 5
drwx--x--x 2 sisyphus group1 520 Jan 22 16:21 letters
SEE ALSO
rm(1), rmdir(1), sh(1), umask(1), mkdir(2).
Page 2 Reliant UNIX 5.44 Printed 11/98