Linux 常用命令 文件目录管理之mkdir

1.命令
mkdir--创建目录

2.使用样例
创建一个目录为test1

andy@ubuntu:~/lhc/linux$ ls
filedirectorymanagement  test  touch
andy@ubuntu:~/lhc/linux$ mkdir test1
andy@ubuntu:~/lhc/linux$ ls
filedirectorymanagement  test  test1  touch
andy@ubuntu:~/lhc/linux$

创建一个多级目录为test1/test2/test3

andy@ubuntu:~/lhc/linux$ mkdir -p test1/test2/test3
andy@ubuntu:~/lhc/linux$ tree
.
├── filedirectorymanagement
│   └── touch
├── test1
│   └── test2
│      └── test3
└── touch
4 directories, 2 files

一次创建多个多级目录,test1/test11,test1/test12

andy@ubuntu:~/lhc/linux$ mkdir -p test1/{test11,test12}
andy@ubuntu:~/lhc/linux$ tree
.
├── filedirectorymanagement
│   └── touch
├── test1
│   ├── test11
│   └── test12
└── touch
4 directories, 2 files

一次性创建多个多级目录,
test/test1,test/test1/test11,test/test1/test12,test/test2/test21,test/test2/test22/test222

andy@ubuntu:~/lhc/linux$ mkdir -p test/{test1/{test11,test12},test2/{test21,test22/test222}}
andy@ubuntu:~/lhc/linux$ tree
.
├── filedirectorymanagement
│   └── touch
├── test
│   ├── test1
│   │   ├── test11
│   │   └── test12
│   └── test2
│      ├── test21
│      └── test22
│          └── test222
└── touch
9 directories, 2 files

创建属性为777的目录,test2

andy@ubuntu:~/lhc/linux$ mkdir -m 777 test2
andy@ubuntu:~/lhc/linux$ ls -l
total 20
drwxrwxr-x 2 andy andy 4096 11月 21 13:42 filedirectorymanagement
drwxrwxr-x 4 andy andy 4096 11月 21 16:21 test
drwxrwxrwx 2 andy andy 4096 11月 21 16:25 test2
-rw-rw-r-- 1 andy andy 7665 11月 21 14:00 touch

3.语法

mkdir[属性]...[目录名]...

4.参数说明

-p 自动创建该目录路劲中的父目录

-m --mode=MODE 创建属性为MODE的目录

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Linux文件与目录管理 我们知道Linux的目录结构为树状结构,最顶级的目录为根目录 /。 其他目录通过挂载可以...
    横竖撇捺啊阅读 328评论 0 0
  • (为了保证服务器的稳定性以及良好的支持(RedHat公司),几乎所有公司都采用centos作为自己的服务器系统,U...
    愤怒的_菜鸟阅读 904评论 1 21
  • 想找你聊天 却找不到话题 带上了假面 任何人都可以看到欢笑 终于有一天我想摘下 却发现忘了如何取下 你突然的出现 ...
    有病的中二少年阅读 250评论 0 2
  • 我喜欢回顾,是因为我不喜欢被忘记。我总认为,在世间,有些人,有些事,有些时刻,都有一种特定的安排,在当时也许不...
    灯下看书阅读 2,101评论 1 7
  • 哇兴奋兴奋!Tokyo Disneyland!就是太晒了,我出门于是就忘了涂防晒霜???人真心好多啊,人山人海的,...
    想喝阿华田阅读 344评论 0 1