teach manpages about largefile's demise
[unleashed.git] / share / man / man1 / mkdir.1
blobde70c2533434d24d77170534fa0a7d71b0e2336f
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
47 .\"
48 .TH MKDIR 1 "Nov 2, 2007"
49 .SH NAME
50 mkdir \- make directories
51 .SH SYNOPSIS
52 .SS "/usr/bin/mkdir"
53 .LP
54 .nf
55 \fB/usr/bin/mkdir\fR [\fB-m\fR \fImode\fR] [\fB-p\fR] \fIdir\fR...
56 .fi
58 .SS "ksh93"
59 .LP
60 .nf
61 \fBmkdir\fR [\fB-p\fR] [\fB-m\fR \fImode\fR] \fIdir\fR...
62 .fi
64 .SH DESCRIPTION
65 .SS "/usr/bin/mkdir"
66 .sp
67 .LP
68 The \fBmkdir\fR command creates the named directories in mode \fB777\fR
69 (possibly altered by the file mode creation mask \fBumask\fR(1)).
70 .sp
71 .LP
72 Standard entries in a directory (for instance, the files "\fB\&.\fR", for the
73 directory itself, and "\fB\&.\|.\fR", for its parent) are made automatically.
74 \fBmkdir\fR cannot create these entries by name. Creation of a directory
75 requires write permission in the parent directory.
76 .sp
77 .LP
78 The owner-ID and group-ID of the new directories are set to the process's
79 effective user-ID and group-ID, respectively. \fBmkdir\fR calls the
80 \fBmkdir\fR(2) system call.
81 .SS "setgid and mkdir"
82 .sp
83 .LP
84 To change the \fBsetgid\fR bit on a newly created directory, you must use
85 \fBchmod\fR \fBg+s\fR or \fBchmod\fR \fBg-s\fR after executing \fBmkdir\fR.
86 .sp
87 .LP
88 The \fBsetgid\fR bit setting is inherited from the parent directory.
89 .SS "ksh93"
90 .sp
91 .LP
92 The \fBmkdir\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
93 \fB/usr/bin\fR paths. It is invoked when \fBmkdir\fR is executed without a
94 pathname prefix and the pathname search finds a \fB/bin/mkdir\fR or
95 \fB/usr/bin/mkdir\fR executable. \fBmkdir\fR creates one or more directories.
96 By default, the mode of created directories is \fBa=rwx\fR minus the bits set
97 in \fBumask\fR(1).
98 .SH OPTIONS
99 .SS "/usr/bin/mkdir"
102 The following options are supported by \fB/usr/bin/mkdir\fR:
104 .ne 2
106 \fB\fB-m\fR \fImode\fR\fR
108 .RS 11n
109 This option allows users to specify the mode to be used for new directories.
110 Choices for modes can be found in \fBchmod\fR(1).
114 .ne 2
116 \fB\fB-p\fR\fR
118 .RS 11n
119 With this option, \fBmkdir\fR creates \fIdir\fR by creating all the
120 non-existing parent directories first. The mode given to intermediate
121 directories is the difference between \fB777\fR and the bits set in the file
122 mode creation mask. The difference, however, must be at least \fB300\fR (write
123 and execute permission for the user).
126 .SS "ksh93"
129 The following options are supported by the \fBmkdir\fR built-in in \fBksh93\fR:
131 .ne 2
133 \fB\fB-m\fR \fImode\fR\fR
137 \fB\fB--mode=\fR\fImode\fR\fR
139 .RS 15n
140 Set the mode of created directories to \fImode\fR. \fImode\fR is symbolic or
141 octal mode as in \fBchmod\fR(1). Relative modes assume an initial mode of
142 \fBa=rwx\fR.
146 .ne 2
148 \fB\fB-p\fR\fR
152 \fB\fB--parents\fR\fR
154 .RS 15n
155 Create any missing intermediate pathname components. For each dir operand that
156 does not name an existing directory, effects equivalent to those caused by the
157 following command shall occur:
159 .in +2
161 mkdir -p -m $(umask -S),u+wx \e
162      $(dirname dir) && mkdir [-m mode] dir
164 .in -2
167 Where the \fB-m\fR mode option represents that option supplied to the original
168 invocation of \fBmkdir\fR, if any. Each \fBdir\fR operand that names an
169 existing directory is ignored without error.
172 .SH OPERANDS
175 The following operand is supported:
177 .ne 2
179 \fB\fIdir\fR\fR
181 .RS 7n
182 A path name of a directory to be created.
185 .SH EXAMPLES
187 \fBExample 1 \fRUsing \fBmkdir\fR
190 The following example:
193 .in +2
195 example% \fBmkdir -p ltr/jd/jan\fR
197 .in -2
202 creates the subdirectory structure \fBltr/jd/jan\fR.
204 .SH ENVIRONMENT VARIABLES
207 See \fBenviron\fR(5) for descriptions of the following environment variables
208 that affect the execution of \fBmkdir\fR: \fBLANG\fR, \fBLC_ALL\fR,
209 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
210 .SH EXIT STATUS
213 The following exit values are returned:
215 .ne 2
217 \fB\fB0\fR\fR
219 .RS 6n
220 All the specified directories were created successfully or the \fB-p\fR option
221 was specified and all the specified directories now exist.
225 .ne 2
227 \fB\fB>0\fR\fR
229 .RS 6n
230 An error occurred.
233 .SH ATTRIBUTES
236 See \fBattributes\fR(5) for descriptions of the following attributes:
237 .SS "/usr/bin/mkdir"
242 box;
243 c | c
244 l | l .
245 ATTRIBUTE TYPE  ATTRIBUTE VALUE
247 CSI     Enabled
249 Interface Stability     Committed
251 Standard        See \fBstandards\fR(5).
254 .SS "ksh93"
259 box;
260 c | c
261 l | l .
262 ATTRIBUTE TYPE  ATTRIBUTE VALUE
264 Interface Stability     See below.
266 Standard        See \fBstandards\fR(5).
271 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
272 The built-in interfaces are Uncommitted.
273 .SH SEE ALSO
276 \fBchmod\fR(1), \fBksh93\fR(1), \fBrm\fR(1), \fBsh\fR(1), \fBumask\fR(1),
277 \fBIntro\fR(2), \fBmkdir\fR(2), \fBattributes\fR(5), \fBenviron\fR(5),
278 \fBstandards\fR(5)