博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux常用基本命令( mkdir )
阅读量:5093 次
发布时间:2019-06-13

本文共 3110 字,大约阅读时间需要 10 分钟。

mkdir:

作用:创建目录( make directories )

命令格式: make [option] 目录

1,创建目录, 当目录存在时,再次创建会提示文件已经存在

ghostwu@dev:~/linux/mkdir$ lsghostwu@dev:~/linux/mkdir$ tree -d.0 directoriesghostwu@dev:~/linux/mkdir$ mkdir aghostwu@dev:~/linux/mkdir$ lsaghostwu@dev:~/linux/mkdir$ mkdir amkdir: cannot create directory ‘a’: File exists

2,可以一次性创建多个目录

ghostwu@dev:~/linux/mkdir$ lsaghostwu@dev:~/linux/mkdir$ mkdir b c dghostwu@dev:~/linux/mkdir$ lsa  b  c  d

3,当一个目录的上级目录不存在时候,需要用-p 递归创建

ghostwu@dev:~/linux/mkdir$ lsa  b  c  dghostwu@dev:~/linux/mkdir$ mkdir e/testmkdir: cannot create directory ‘e/test’: No such file or directoryghostwu@dev:~/linux/mkdir$ lsa  b  c  dghostwu@dev:~/linux/mkdir$ mkdir -p e/testghostwu@dev:~/linux/mkdir$ tree.├── a├── b├── c├── d└── e    └── test

4,-v 输出创建目录过程的详细信息

ghostwu@dev:~/linux/mkdir$ mkdir f/a/b/c -pvmkdir: created directory 'f'mkdir: created directory 'f/a'mkdir: created directory 'f/a/b'mkdir: created directory 'f/a/b/c'ghostwu@dev:~/linux/mkdir$ tree ff└── a    └── b        └── c

5,大括号:表示范围与展开:

ghostwu@dev:~/linux/mkdir$ mkdir -pv a/{b,c,d,e,f}mkdir: created directory 'a'mkdir: created directory 'a/b'mkdir: created directory 'a/c'mkdir: created directory 'a/d'mkdir: created directory 'a/e'mkdir: created directory 'a/f'ghostwu@dev:~/linux/mkdir$ tree.└── a    ├── b    ├── c    ├── d    ├── e    └── f
ghostwu@dev:~/linux/mkdir$ mkdir -pv a/{
1..10}mkdir: created directory 'a'mkdir: created directory 'a/1'mkdir: created directory 'a/2'mkdir: created directory 'a/3'mkdir: created directory 'a/4'mkdir: created directory 'a/5'mkdir: created directory 'a/6'mkdir: created directory 'a/7'mkdir: created directory 'a/8'mkdir: created directory 'a/9'mkdir: created directory 'a/10'ghostwu@dev:~/linux/mkdir$ tree.└── a ├── 1 ├── 10 ├── 2 ├── 3 ├── 4 ├── 5 ├── 6 ├── 7 ├── 8 └── 9
ghostwu@dev:~/linux/mkdir$ mkdir -pv b/{a..z}mkdir: created directory 'b'mkdir: created directory 'b/a'mkdir: created directory 'b/b'mkdir: created directory 'b/c'mkdir: created directory 'b/d'mkdir: created directory 'b/e'mkdir: created directory 'b/f'mkdir: created directory 'b/g'mkdir: created directory 'b/h'mkdir: created directory 'b/i'mkdir: created directory 'b/j'mkdir: created directory 'b/k'mkdir: created directory 'b/l'mkdir: created directory 'b/m'mkdir: created directory 'b/n'mkdir: created directory 'b/o'mkdir: created directory 'b/p'mkdir: created directory 'b/q'mkdir: created directory 'b/r'mkdir: created directory 'b/s'mkdir: created directory 'b/t'mkdir: created directory 'b/u'mkdir: created directory 'b/v'mkdir: created directory 'b/w'mkdir: created directory 'b/x'mkdir: created directory 'b/y'mkdir: created directory 'b/z'ghostwu@dev:~/linux/mkdir$ tree.├── a│   ├── 1│   ├── 10│   ├── 2│   ├── 3│   ├── 4│   ├── 5│   ├── 6│   ├── 7│   ├── 8│   └── 9└── b    ├── a    ├── b    ├── c    ├── d    ├── e    ├── f    ├── g    ├── h    ├── i    ├── j    ├── k    ├── l    ├── m    ├── n    ├── o    ├── p    ├── q    ├── r    ├── s    ├── t    ├── u    ├── v    ├── w    ├── x    ├── y    └── z

 

转载于:https://www.cnblogs.com/ghostwu/p/8976806.html

你可能感兴趣的文章
Codeforces 758F Geometrical Progression
查看>>
Codeforces 1009G Allowed Letters 最大流转最小割 sosdp
查看>>
Codeforces 1174E Ehab and the Expected GCD Problem
查看>>
Http协议对格式、请求头、方法
查看>>
关于WM_GETTEXT的应用
查看>>
out
查看>>
A New Gyratory Crusher Recommended to You Two
查看>>
FATAL ERROR: Could not find ./share/fill_help_tables.sql
查看>>
win10找回win7的windows照片查看器
查看>>
Nagios配置文件nagios.cfg详解
查看>>
Fail2ban
查看>>
WPF事件,路由事件
查看>>
深度学习资料
查看>>
SpringCloud 中使用 Ribbon(默认轮询规则 + 自定义规则)
查看>>
网站大全
查看>>
个人作业(二)
查看>>
加密解密:使用对称密码加密文件
查看>>
UITableViewCell不重用代码
查看>>
bean拆分
查看>>
10.03今日暂时停更博客
查看>>