coreutils: mkdir invocation
1
1 12.3 ‘mkdir’: Make directories
1 ==============================
1
1 ‘mkdir’ creates directories with the specified names. Synopsis:
1
1 mkdir [OPTION]... NAME...
1
1 ‘mkdir’ creates each directory NAME in the order given. It reports
1 an error if NAME already exists, unless the ‘-p’ option is given and
1 NAME is a directory.
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-m MODE’
1 ‘--mode=MODE’
1 Set the file permission bits of created directories to MODE, which
1 uses the same syntax as in ‘chmod’ and uses ‘a=rwx’ (read, write
1 and execute allowed for everyone) for the point of the departure.
1 ⇒File permissions.
1
1 Normally the directory has the desired file mode bits at the moment
1 it is created. As a GNU extension, MODE may also mention special
1 mode bits, but in this case there may be a temporary window during
1 which the directory exists but its special mode bits are incorrect.
1 ⇒Directory Setuid and Setgid, for how the set-user-ID and
1 set-group-ID bits of directories are inherited unless overridden in
1 this way.
1
1 Note: The ‘--mode’,‘-m’ option only applies to the right-most
1 directories listed on the command line. When combined with
1 ‘--parents’, ‘-p’ option, any parent directories are created with
1 ‘u+wx’ modified by umask.
1
1 ‘-p’
1 ‘--parents’
1 Make any missing parent directories for each argument, setting
1 their file permission bits to the umask modified by ‘u+wx’. Ignore
1 existing parent directories, and do not change their file
1 permission bits.
1
1 To set the file permission bits of any newly-created parent
1 directories to a value that includes ‘u+wx’, you can set the umask
1 before invoking ‘mkdir’. For example, if the shell command ‘(umask
1 u=rwx,go=rx; mkdir -p P/Q)’ creates the parent ‘P’ it sets the
1 parent’s permission bits to ‘u=rwx,go=rx’. To set a parent’s
1 special mode bits as well, you can invoke ‘chmod’ after ‘mkdir’.
1 ⇒Directory Setuid and Setgid, for how the set-user-ID and
1 set-group-ID bits of newly-created parent directories are
1 inherited.
1
1 ‘-v’
1 ‘--verbose’
1 Print a message for each created directory. This is most useful
1 with ‘--parents’.
1
1 ‘-Z’
1 ‘--context[=CONTEXT]’
1 Without a specified CONTEXT, adjust the SELinux security context
1 according to the system default type for destination files,
1 similarly to the ‘restorecon’ command. The long form of this
1 option with a specific context specified, will set the context for
1 newly created files only. With a specified context, if both
1 SELinux and SMACK are disabled, a warning is issued.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1