Ubuntu22.04桌面版的 mkdir , mkdir -p 命令笔记2221107

Ubuntu22.04桌面版的 mkdir 命令笔记

mkdir 用于创建文件夹

mkdir -p 自动创建父文件夹,父文件夹存不存在都没关系, 等效 mkdir --parents

在这里插入图片描述

mkdir --help

用法:mkdir [选项]… 目录…
若指定<目录>不存在则创建目录。

必选参数对长短选项同时适用。
-m, --mode=模式 设置权限模式(类似chmod),而不是 a=rwx 减 umask
-p, --parents 需要时创建目标目录的上层目录,但即使这些目录已存在
也不当作错误处理
-v, --verbose 每次创建新目录都显示信息
-Z 设置每个创建的目录的 SELinux 安全上下文为默认类型
–context[=CTX] 类似 -Z,或如果指定了 CTX,则将 SELinux 或 SMACK 安全
上下文设置为 CTX 对应的值
–help 显示此帮助信息并退出
–version 显示版本信息并退出

用法:mkdir [选项]... 目录...
若指定<目录>不存在则创建目录。

必选参数对长短选项同时适用。
  -m, --mode=模式   设置权限模式(类似chmod),而不是 a=rwx 减 umask
  -p, --parents     需要时创建目标目录的上层目录,但即使这些目录已存在
                      也不当作错误处理
  -v, --verbose     每次创建新目录都显示信息
  -Z                   设置每个创建的目录的 SELinux 安全上下文为默认类型
      --context[=CTX]  类似 -Z,或如果指定了 CTX,则将 SELinux 或 SMACK 安全
                         上下文设置为 CTX 对应的值
      --help		显示此帮助信息并退出
      --version		显示版本信息并退出
man mkdir
MKDIR(1)                                                     User Commands                                                    MKDIR(1)

NAME
       mkdir - make directories

SYNOPSIS
       mkdir [OPTION]... DIRECTORY...

DESCRIPTION
       Create the DIRECTORY(ies), if they do not already exist.

       Mandatory arguments to long options are mandatory for short options too.

       -m, --mode=MODE
              set file mode (as in chmod), not a=rwx - umask

       -p, --parents
              no error if existing, make parent directories as needed

       -v, --verbose
              print a message for each created directory

       -Z     set SELinux security context of each created directory to the default type

       --context[=CTX]
              like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX

       --help display this help and exit

       --version
              output version information and exit

AUTHOR
       Written by David MacKenzie.

REPORTING BUGS
       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
       Report any translation bugs to <https://translationproject.org/team/>

COPYRIGHT
       Copyright  ©  2020  Free  Software  Foundation,  Inc.   License  GPLv3+:  GNU  GPL  version  3  or  later  <https://gnu.org/li‐
       censes/gpl.html>.
       This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       mkdir(2)

       Full documentation <https://www.gnu.org/software/coreutils/mkdir>
       or available locally via: info '(coreutils) mkdir invocation'

GNU coreutils 8.32                                           February 2022                                                    MKDIR(1)

MKDIR(1) User Commands MKDIR(1)

NAME
mkdir - make directories

SYNOPSIS
mkdir [OPTION]… DIRECTORY…

DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.

   Mandatory arguments to long options are mandatory for short options too.

   -m, --mode=MODE
          set file mode (as in chmod), not a=rwx - umask

   -p, --parents
          no error if existing, make parent directories as needed

   -v, --verbose
          print a message for each created directory

   -Z     set SELinux security context of each created directory to the default type

   --context[=CTX]
          like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX

   --help display this help and exit

   --version
          output version information and exit

AUTHOR
Written by David MacKenzie.

REPORTING BUGS
GNU coreutils online help: https://www.gnu.org/software/coreutils/
Report any translation bugs to https://translationproject.org/team/

COPYRIGHT
Copyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/li‐
censes/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
mkdir(2)

   Full documentation <https://www.gnu.org/software/coreutils/mkdir>
   or available locally via: info '(coreutils) mkdir invocation'

GNU coreutils 8.32 February 2022 MKDIR(1)

info mkdir
File: coreutils.info,  Node: mkdir invocation,  Next: mkfifo invocation,  Prev: ln invocation,  Up: Special file types

12.3 ‘mkdir’: Make directories
==============================

‘mkdir’ creates directories with the specified names.  Synopsis:

     mkdir [OPTION]... NAME...

   ‘mkdir’ creates each directory NAME in the order given.  It reports
an error if NAME already exists, unless the ‘-p’ option is given and
NAME is a directory.

   The program accepts the following options.  Also see *note Common
options::.

‘-m MODE’
‘--mode=MODE’
     Set the file permission bits of created directories to MODE, which
     uses the same syntax as in ‘chmod’ and uses ‘a=rwx’ (read, write
     and execute allowed for everyone) for the point of the departure.
     *Note File permissions::.

     Normally the directory has the desired file mode bits at the moment
     it is created.  As a GNU extension, MODE may also mention special
     mode bits, but in this case there may be a temporary window during
     which the directory exists but its special mode bits are incorrect.
     *Note Directory Setuid and Setgid::, for how the set-user-ID and
     set-group-ID bits of directories are inherited unless overridden in
     this way.

‘-p’
‘--parents’
     Make any missing parent directories for each argument, setting
     their file permission bits to the umask modified by ‘u+wx’.  Ignore
     existing parent directories, and do not change their file
     permission bits.

     To set the file permission bits of any newly-created parent
     directories to a value that includes ‘u+wx’, you can set the umask
     before invoking ‘mkdir’.  For example, if the shell command ‘(umask
     u=rwx,go=rx; mkdir -p P/Q)’ creates the parent ‘P’ it sets the
     parent’s permission bits to ‘u=rwx,go=rx’.  To set a parent’s
     special mode bits as well, you can invoke ‘chmod’ after ‘mkdir’.
     *Note Directory Setuid and Setgid::, for how the set-user-ID and
     set-group-ID bits of newly-created parent directories are
     inherited.

‘-v’
‘--verbose’
     Print a message for each created directory.  This is most useful
     with ‘--parents’.

‘-Z’
‘--context[=CONTEXT]’
     Without a specified CONTEXT, adjust the SELinux security context
     according to the system default type for destination files,
     similarly to the ‘restorecon’ command.  The long form of this
     option with a specific context specified, will set the context for
     newly created files only.  With a specified context, if both
     SELinux and SMACK are disabled, a warning is issued.

   An exit status of zero indicates success, and a nonzero value
indicates failure.


File: coreutils.info, Node: mkdir invocation, Next: mkfifo invocation, Prev: ln invocation, Up: Special file types

12.3 ‘mkdir’: Make directories

‘mkdir’ creates directories with the specified names. Synopsis:

 mkdir [OPTION]... NAME...

‘mkdir’ creates each directory NAME in the order given. It reports
an error if NAME already exists, unless the ‘-p’ option is given and
NAME is a directory.

The program accepts the following options. Also see *note Common
options::.

‘-m MODE’
‘–mode=MODE’
Set the file permission bits of created directories to MODE, which
uses the same syntax as in ‘chmod’ and uses ‘a=rwx’ (read, write
and execute allowed for everyone) for the point of the departure.
*Note File permissions::.

 Normally the directory has the desired file mode bits at the moment
 it is created.  As a GNU extension, MODE may also mention special
 mode bits, but in this case there may be a temporary window during
 which the directory exists but its special mode bits are incorrect.
 *Note Directory Setuid and Setgid::, for how the set-user-ID and
 set-group-ID bits of directories are inherited unless overridden in
 this way.

‘-p’
‘–parents’
Make any missing parent directories for each argument, setting
their file permission bits to the umask modified by ‘u+wx’. Ignore
existing parent directories, and do not change their file
permission bits.

 To set the file permission bits of any newly-created parent
 directories to a value that includes ‘u+wx’, you can set the umask
 before invoking ‘mkdir’.  For example, if the shell command ‘(umask
 u=rwx,go=rx; mkdir -p P/Q)’ creates the parent ‘P’ it sets the
 parent’s permission bits to ‘u=rwx,go=rx’.  To set a parent’s
 special mode bits as well, you can invoke ‘chmod’ after ‘mkdir’.
 *Note Directory Setuid and Setgid::, for how the set-user-ID and
 set-group-ID bits of newly-created parent directories are
 inherited.

‘-v’
‘–verbose’
Print a message for each created directory. This is most useful
with ‘–parents’.

‘-Z’
‘–context[=CONTEXT]’
Without a specified CONTEXT, adjust the SELinux security context
according to the system default type for destination files,
similarly to the ‘restorecon’ command. The long form of this
option with a specific context specified, will set the context for
newly created files only. With a specified context, if both
SELinux and SMACK are disabled, a warning is issued.

An exit status of zero indicates success, and a nonzero value
indicates failure.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kfepiza

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值