zoukankan      html  css  js  c++  java
  • Linux命令--mkdir

    1.命令介绍

    linux mkdir 命令用来创建指定的名称的目录,要求创建目录的用户在当前目录中具有写权限,并且指定的目录名不能是当前目录中已有的目录。

    2.命令用途

    创建文件夹

    3.命令使用说明

    [root@moban ~]# 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, --context=CTX set the SELinux security context of each created
    directory to CTX
    --help display this help and exit
    --version output version information and exit

    4.命令常用参数说明

    参数选项 参数说明
    -m 在创建文件夹时,自己设定文件夹权限
    -p 若创建子目录不存在,可递归创建
    -v 显示创建目录的信息

    5.命令示例

    5.1 不带参数

    [root@moban ~]# mkdir /test1

    [root@moban ~]# ls -ld /test1
    drwxr-xr-x 2 root root 4096 Sep 25 10:50 /test1

    5.2 -p参数

    [root@moban ~]# mkdir /test2/abc
    mkdir: cannot create directory `/test2/abc': No such file or directory
    [root@moban ~]# mkdir -p /test2/abc
    [root@moban ~]# ll -ld /test2/abc
    drwxr-xr-x 2 root root 4096 Sep 25 10:51 /test2/abc

    5.3 -m参数

    [root@moban ~]# mkdir /aaa
    [root@moban ~]# ls -ld /aaa
    drwxr-xr-x 2 root root 4096 Sep 25 10:52 /aaa

    [root@moban ~]# mkdir -m 777 bbb
    [root@moban ~]# ls -ld bbb
    drwxrwxrwx 2 root root 4096 Sep 25 10:53 bbb

    5.4 -v参数

    [root@moban ~]# mkdir -v ccc
    mkdir: created directory `ccc'

  • 相关阅读:
    CF D. Ehab and the Expected XOR Problem 贪心+位运算
    luogu 1903 [国家集训队]数颜色 / 维护队列 带修改莫队
    Test 1 T2 B 线段树合并
    CF812C Sagheer and Nubian Market 二分+贪心
    CF804B Minimum number of steps
    CF796D Police Stations BFS+染色
    CF796C Bank Hacking 细节
    k8s节点NotReady问题处理
    Elastic-Job快速入门
    Elastic-Job介绍
  • 原文地址:https://www.cnblogs.com/ladeng/p/4837529.html
Copyright © 2011-2022 走看看