博客园  :: 首页  :: 管理

每天一个Linux命令-mkdir.

Posted on 2021-05-25 09:04  520_1351  阅读(85)  评论(0编辑  收藏  举报

mkdir命令用于创建目录,常用的一些选项如下

 

1、创建多级目录/级联目录,一般创建目录时,要求父目录必须存在,否则会报错,不过可以通过加上-p选项解决

mkdir -p /aa/bb/cc/dd/ee

2、创建目录时,指定权限,如要创建一个drwxr-x---权限的目录

mkdir -m 750 tempdir

 

mkdir命令的帮助选项:

[qq_5201351@localhost ~]$ mkdir --help
Usage: mkdir [OPTION]... DIRECTORY...
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

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'mkdir invocation'

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/14807192.html