目录创建命令
mkdir
make directory
mkdir [option]... directory...
创建目录 【选项可有可无,可有多个】 目录名称,也可以有多个
-p: 递归创建目录,如果目录已存在,则不创建,且不报错
-V:打印/显示目录的创建过程。
-pv / -vp :递归创建且显示目录创建的过程
[root@localhostroot\ <sub> ]
[root@localhostroot\ </sub> ]
[root@localhostroot\ <sub> ]
[root@localhostroot\ </sub> ]
a abc b c d oldboyedu one x_m x_n y_m y_n
[root@localhostroot\ <sub> ]
[root@localhostroot\ </sub> ]
mkdir: cannot create directory ‘/dsjdj/dfjdsj’: No such file or directory
[root@localhostroot\ <sub> ]
mkdir: cannot create directory ‘/root/abc/five’: File exists
[root@localhostroot\ </sub> ]
[root@localhostroot\ <sub> ]
1 10 2 3 4 5 6 7 8 9 a abc b c d oldboyedu one wy x_m x_n y_m y_n
[root@localhost </sub>]
[root@localhost <sub>]
[root@localhostroot\ </sub> ]
mkdir: cannot create directory ‘a’: File exists
mkdir: cannot create directory ‘b’: File exists
mkdir: cannot create directory ‘c’: File exists
mkdir: cannot create directory ‘d’: File exists
[root@localhostroot\ <sub> ]
1 10 2 3 4 5 6 7 8 9 a abc b c d e oldboy oldboyedu oldgirl one wy x_m x_n y_m y_n
[root@localhostroot\ </sub> ]
[root@localhostroot\ <sub> ]
1 2 4 6 8 a b d f oldboyedu one x_m y_m
10 3 5 7 9 abc c e oldboy oldgirl wy x_n y_n
[root@localhostroot\ </sub> ]
普通文件创建
touch
只能创建出,可编辑的普通文件
touch想要创建文件,该文件的上级目录必须存在
touch [OPTION]... FILE...
touch命令 [选项] 普通文件的文件名 可以写多个
touch创建文件,如果文件已存在,不报错,也不覆盖,只会修改文件的创建时间戳
[root@localhostroot\ <sub> ]
[root@localhostroot\ </sub> ]
a b c d e five wy zls.txt
[root@localhostroot\ <sub> ]
[root@localhostroot\ </sub> ]
ks-script-DdBArs vmware-root_6453-1950098183 vmware-root_6559-1723274355 zls
[root@localhostroot\ ~ ]
touch: cannot touch ‘/bcd/123.txt’: No such file or directory
移动/剪切命令
mv : move
mv [option]... source dest
mv [选项] 源文件... 目标路径
[root@localhostroot\ <sub> ]
[root@localhostroot\ </sub> ]
1 2 4 6 8 a b d f oldboyedu one x_m y_m zls.txt
10 3 5 7 9 abc c e oldboy oldgirl wy x_n y_n
[root@localhostroot\ <sub> ]
a b c d e five wy
[root@localhostroot\ </sub> ]
[root@localhostroot\ <sub> ]
a b c d e five wy xyz
[root@localhostroot\ </sub> ]
/root/abc/xyz
[root@localhostroot\ <sub> ]
1 2 4 6 8 a b d f oldboyedu one x_m y_m
10 3 5 7 9 abc c e oldboy oldgirl wy x_n y_n
[root@localhostroot\ </sub> ]
才貌惊人,羡飒众人;方圆数里,亲邻均望其待嫁,盼其亲好。
树状显示目录结构
tree
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-
7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
tree [option]... 路径
-L:后面接数字,查看指定层级的目录
-d:只看所有的目录,不看普通文件
-dL3:只看目录,看到第三层(高级组合选项,是需要关注顺序的,接数字的置后)
[root@localhost <sub>]
-bash: /usr/bin/tree: No such file or directory
-bash: tree: Command not found
[root@localhostroot\ </sub> ]
/root/abc
├── five
└── wy
