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

本文共 3059 字,大约阅读时间需要 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

 

转载地址:http://zqnno.baihongyu.com/

你可能感兴趣的文章
Ext.getCmp()的简单使用
查看>>
前端样板资源概览及总评
查看>>
atitit.常用编程语言的性能比较 c c++ java
查看>>
[开发笔记]-实现winform半透明毛玻璃效果
查看>>
一款非常棒的纯CSS3 3D菜单演示及制作教程
查看>>
CSS3+HTML5特效8 - 顶部和右侧固定,左侧随窗口变化的布局
查看>>
利用c#+jquery+echarts生成统计报表(附源代码)
查看>>
簡單SQL存儲過程實例
查看>>
于西蔓_百度百科
查看>>
AMD and CMD are dead之KMD.js依赖可视化工具发布
查看>>
网页刷新方法集合
查看>>
[Android]对BaseAdapter中ViewHolder编写简化(转)
查看>>
java画图程序_图片用字母画出来_源码发布_版本二
查看>>
[Node.js]23. Level 4: Semantic versioning
查看>>
[Z] 将samba共享文件夹映射到linux的目录下
查看>>
Java设计模式----观察者模式详解
查看>>
java entry
查看>>
JQuery.Ajax()的data参数类型
查看>>
8.1.3 在BroadcastReceiver中启动Service
查看>>
【python】入门学习(七)
查看>>