xref: /freebsd/bin/mkdir/mkdir.1 (revision 90aea514c6249118e880d75972d063362f4bf492)
19ddb49cbSWarner Losh.\"-
24b88c807SRodney W. Grimes.\" Copyright (c) 1989, 1990, 1993
34b88c807SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
44b88c807SRodney W. Grimes.\"
54b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
64b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
74b88c807SRodney W. Grimes.\"
84b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
94b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions
104b88c807SRodney W. Grimes.\" are met:
114b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
124b88c807SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
134b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
144b88c807SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
154b88c807SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
16*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
174b88c807SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
184b88c807SRodney W. Grimes.\"    without specific prior written permission.
194b88c807SRodney W. Grimes.\"
204b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
214b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
234b88c807SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
244b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
254b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
264b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
274b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
284b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
294b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
304b88c807SRodney W. Grimes.\" SUCH DAMAGE.
314b88c807SRodney W. Grimes.\"
32e9e3a1abSJoel Dahl.Dd March 15, 2013
334b88c807SRodney W. Grimes.Dt MKDIR 1
344b88c807SRodney W. Grimes.Os
354b88c807SRodney W. Grimes.Sh NAME
364b88c807SRodney W. Grimes.Nm mkdir
374b88c807SRodney W. Grimes.Nd make directories
384b88c807SRodney W. Grimes.Sh SYNOPSIS
39be8b1497SRuslan Ermilov.Nm
402f5f84c5SMichael Haro.Op Fl pv
414b88c807SRodney W. Grimes.Op Fl m Ar mode
424b88c807SRodney W. Grimes.Ar directory_name ...
434b88c807SRodney W. Grimes.Sh DESCRIPTION
44e004acc8SPhilippe CharnierThe
45e004acc8SPhilippe Charnier.Nm
46e004acc8SPhilippe Charnierutility creates the directories named as operands, in the order specified,
474b88c807SRodney W. Grimesusing mode
481ee7aa60SRuslan Ermilov.Dq Li rwxrwxrwx
49c92beb6dSRuslan Ermilov(0777)
504b88c807SRodney W. Grimesas modified by the current
514b88c807SRodney W. Grimes.Xr umask 2 .
524b88c807SRodney W. Grimes.Pp
534b88c807SRodney W. GrimesThe options are as follows:
541ee7aa60SRuslan Ermilov.Bl -tag -width ".Fl m Ar mode"
5590f72c84STim J. Robbins.It Fl m Ar mode
564b88c807SRodney W. GrimesSet the file permission bits of the final created directory to
574b88c807SRodney W. Grimesthe specified mode.
5890f72c84STim J. RobbinsThe
5990f72c84STim J. Robbins.Ar mode
6090f72c84STim J. Robbinsargument can be in any of the formats specified to the
614b88c807SRodney W. Grimes.Xr chmod 1
624b88c807SRodney W. Grimescommand.
634b88c807SRodney W. GrimesIf a symbolic mode is specified, the operation characters
64c92beb6dSRuslan Ermilov.Ql +
654b88c807SRodney W. Grimesand
66c92beb6dSRuslan Ermilov.Ql -
674b88c807SRodney W. Grimesare interpreted relative to an initial mode of
68c92beb6dSRuslan Ermilov.Dq Li a=rwx .
694b88c807SRodney W. Grimes.It Fl p
704b88c807SRodney W. GrimesCreate intermediate directories as required.
714b88c807SRodney W. GrimesIf this option is not specified, the full path prefix of each
724b88c807SRodney W. Grimesoperand must already exist.
73c8dac8d4SYaroslav TykhiyOn the other hand, with this option specified, no error will
74c8dac8d4SYaroslav Tykhiybe reported if a directory given as an operand already exists.
754b88c807SRodney W. GrimesIntermediate directories are created with permission bits of
761ee7aa60SRuslan Ermilov.Dq Li rwxrwxrwx
77c92beb6dSRuslan Ermilov(0777)
784b88c807SRodney W. Grimesas modified by the current umask, plus write and search
794b88c807SRodney W. Grimespermission for the owner.
80d3183183SMike Pritchard.It Fl v
811df89a60SMichael HaroBe verbose when creating directories, listing them as they are created.
824b88c807SRodney W. Grimes.El
834b88c807SRodney W. Grimes.Pp
844b88c807SRodney W. GrimesThe user must have write permission in the parent directory.
856fca4c7cSRuslan Ermilov.Sh EXIT STATUS
86d628d776SRuslan Ermilov.Ex -std
87e9e3a1abSJoel Dahl.Sh EXAMPLES
88e9e3a1abSJoel DahlCreate a directory named
89e9e3a1abSJoel Dahl.Pa foobar :
90e9e3a1abSJoel Dahl.Pp
91e9e3a1abSJoel Dahl.Dl $ mkdir foobar
92e9e3a1abSJoel Dahl.Pp
93e9e3a1abSJoel DahlCreate a directory named
94e9e3a1abSJoel Dahl.Pa foobar
95e9e3a1abSJoel Dahland set its file mode to 700:
96e9e3a1abSJoel Dahl.Pp
97e9e3a1abSJoel Dahl.Dl $ mkdir -m 700 foobar
98e9e3a1abSJoel Dahl.Pp
99e9e3a1abSJoel DahlCreate a directory named
100e9e3a1abSJoel Dahl.Pa cow/horse/monkey ,
101e9e3a1abSJoel Dahlcreating any non-existent intermediate directories as necessary:
102e9e3a1abSJoel Dahl.Pp
103e9e3a1abSJoel Dahl.Dl $ mkdir -p cow/horse/monkey
1042f5f84c5SMichael Haro.Sh COMPATIBILITY
1052f5f84c5SMichael HaroThe
1062f5f84c5SMichael Haro.Fl v
1072f5f84c5SMichael Harooption is non-standard and its use in scripts is not recommended.
1086fca4c7cSRuslan Ermilov.Sh SEE ALSO
1096fca4c7cSRuslan Ermilov.Xr rmdir 1
1104b88c807SRodney W. Grimes.Sh STANDARDS
1114b88c807SRodney W. GrimesThe
11206f62885SPhilippe Charnier.Nm
1134b88c807SRodney W. Grimesutility is expected to be
1144b88c807SRodney W. Grimes.St -p1003.2
1154b88c807SRodney W. Grimescompatible.
116b8923d4cSWolfram Schneider.Sh HISTORY
117b8923d4cSWolfram SchneiderA
118b8923d4cSWolfram Schneider.Nm
119b8923d4cSWolfram Schneidercommand appeared in
120b8923d4cSWolfram Schneider.At v1 .
121