美文网首页Linux我用 LinuxLinux
Linux 常用命令 文件目录管理之mkdir

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

作者: OKLSW | 来源:发表于2016-11-21 17:01 被阅读38次

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 常用命令 文件目录管理之mkdir

    本文链接:https://www.haomeiwen.com/subject/bdmupttx.html