1.\" $OpenBSD: mkdir.1,v 1.27 2010/09/03 09:53:20 jmc Exp $ 2.\" $NetBSD: mkdir.1,v 1.9 1995/07/25 19:37:13 jtc Exp $ 3.\" 4.\" Copyright (c) 1989, 1990, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" This code is derived from software contributed to Berkeley by 8.\" the Institute of Electrical and Electronics Engineers, Inc. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)mkdir.1 8.2 (Berkeley) 1/25/94 35.\" 36.Dd $Mdocdate: September 3 2010 $ 37.Dt MKDIR 1 38.Os 39.Sh NAME 40.Nm mkdir 41.Nd make directories 42.Sh SYNOPSIS 43.Nm mkdir 44.Op Fl p 45.Op Fl m Ar mode 46.Ar directory ... 47.Sh DESCRIPTION 48The 49.Nm 50utility creates the directories named as operands, in the order specified, 51using mode 52.Li rwxrwxrwx (\&0777) 53as modified by the current 54.Xr umask 2 . 55.Pp 56The options are as follows: 57.Bl -tag -width Ds 58.It Fl m Ar mode 59Set the file permission bits of the newly created directory to 60.Ar mode . 61The mode argument can be in any of the formats specified to the 62.Xr chmod 1 63utility. 64If a symbolic mode is specified, the operators 65.Ql + 66and 67.Ql - 68are interpreted relative to an initial mode of 69.Dq a=rwx . 70.It Fl p 71Create intermediate directories as required. 72If this option is not specified, the full path prefix of each 73operand must already exist. 74Intermediate directories are created with permission bits of 75.Li rwxrwxrwx (\&0777) 76as modified by the current umask, plus write and search 77permission for the owner. 78Do not consider it an error if the 79argument directory already exists. 80.El 81.Pp 82The user must have write permission in the parent directory. 83For an explanation of the directory hierarchy, 84see 85.Xr hier 7 . 86.Sh EXIT STATUS 87.Ex -std mkdir 88.Sh EXAMPLES 89Create a directory named 90.Pa foobar : 91.Pp 92.Dl $ mkdir foobar 93.Pp 94Create a directory named 95.Pa foobar 96and set its file mode to 700: 97.Pp 98.Dl $ mkdir -m 700 foobar 99.Pp 100Create a directory named 101.Pa cow/horse/monkey , 102creating any non-existent intermediate directories as necessary: 103.Pp 104.Dl $ mkdir -p cow/horse/monkey 105.Sh SEE ALSO 106.Xr chmod 1 , 107.Xr rmdir 1 , 108.Xr mkdir 2 , 109.Xr umask 2 , 110.Xr hier 7 111.Sh STANDARDS 112The 113.Nm 114utility is compliant with the 115.St -p1003.1-2008 116specification. 117.Sh HISTORY 118A 119.Nm 120command appeared in 121.At v1 . 122