rmdir 删除空的目录
-p 类似于递归删除,连同上层的空的目录也删除。
[root@python3 mail]# cd
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]# pwd
/root
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]# ll
总用量 232
drwxr-xr-x. 3 root root 4096 1月 10 09:16 a
-rw-------. 1 root root 1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root 4096 1月 14 14:49 a_test1_bak
-rw-r--r--. 1 root root 391 1月 11 18:16 a.txt
drwxr-xr-x. 2 root root 4096 1月 12 08:43 b
drwxr-xr-x. 2 root root 4096 1月 12 10:20 c
d---------. 2 root root 4096 1月 12 16:03 d
drwxr-xr-x. 2 root root 4096 1月 12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root 391 1月 12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月 12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月 13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root 391 1月 12 13:24 yy.txt
drwxr-xr-x. 2 root root 4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root 4096 11月 22 2022 模板
drwxr-xr-x. 2 root root 4096 11月 22 2022 视频
drwxr-xr-x. 2 root root 4096 11月 22 2022 图片
drwxr-xr-x. 2 root root 4096 11月 22 2022 文档
drwxr-xr-x. 2 root root 4096 11月 22 2022 下载
drwxr-xr-x. 2 root root 4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root 4096 11月 22 2022 桌面
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]# mkdir ab
[root@python3 ~]# ll
总用量 236
drwxr-xr-x. 3 root root 4096 1月 10 09:16 a
drwxr-xr-x. 2 root root 4096 1月 14 15:13 ab
-rw-------. 1 root root 1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root 4096 1月 14 14:49 a_test1_bak
-rw-r--r--. 1 root root 391 1月 11 18:16 a.txt
drwxr-xr-x. 2 root root 4096 1月 12 08:43 b
drwxr-xr-x. 2 root root 4096 1月 12 10:20 c
d---------. 2 root root 4096 1月 12 16:03 d
drwxr-xr-x. 2 root root 4096 1月 12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root 391 1月 12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月 12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月 13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root 391 1月 12 13:24 yy.txt
drwxr-xr-x. 2 root root 4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root 4096 11月 22 2022 模板
drwxr-xr-x. 2 root root 4096 11月 22 2022 视频
drwxr-xr-x. 2 root root 4096 11月 22 2022 图片
drwxr-xr-x. 2 root root 4096 11月 22 2022 文档
drwxr-xr-x. 2 root root 4096 11月 22 2022 下载
drwxr-xr-x. 2 root root 4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root 4096 11月 22 2022 桌面
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]# mkdir ac/ad/ae
mkdir: 无法创建目录"ac/ad/ae": 没有那个文件或目录
[root@python3 ~]# mkdir -p ac/ad/ae
[root@python3 ~]# ll
总用量 240
drwxr-xr-x. 3 root root 4096 1月 10 09:16 a
drwxr-xr-x. 2 root root 4096 1月 14 15:13 ab
drwxr-xr-x. 3 root root 4096 1月 14 15:14 ac
-rw-------. 1 root root 1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root 4096 1月 14 14:49 a_test1_bak
-rw-r--r--. 1 root root 391 1月 11 18:16 a.txt
drwxr-xr-x. 2 root root 4096 1月 12 08:43 b
drwxr-xr-x. 2 root root 4096 1月 12 10:20 c
d---------. 2 root root 4096 1月 12 16:03 d
drwxr-xr-x. 2 root root 4096 1月 12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root 391 1月 12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月 12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月 13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root 391 1月 12 13:24 yy.txt
drwxr-xr-x. 2 root root 4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root 4096 11月 22 2022 模板
drwxr-xr-x. 2 root root 4096 11月 22 2022 视频
drwxr-xr-x. 2 root root 4096 11月 22 2022 图片
drwxr-xr-x. 2 root root 4096 11月 22 2022 文档
drwxr-xr-x. 2 root root 4096 11月 22 2022 下载
drwxr-xr-x. 2 root root 4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root 4096 11月 22 2022 桌面
[root@python3 ~]# cd ac
[root@python3 ac]# cd ad
[root@python3 ad]# cd ae
[root@python3 ae]# ll
总用量 0
[root@python3 ae]#
[root@python3 ae]# cd
[root@python3 ~]# pwd
/root
[root@python3 ~]#
[root@python3 ~]#
[root@python3 ~]# mkdir -m 000 ad
[root@python3 ~]# ll ./ab
总用量 0
[root@python3 ~]# ll ab
总用量 0
[root@python3 ~]# ll
总用量 244
drwxr-xr-x. 3 root root 4096 1月 10 09:16 a
drwxr-xr-x. 2 root root 4096 1月 14 15:13 ab
drwxr-xr-x. 3 root root 4096 1月 14 15:14 ac
d---------. 2 root root 4096 1月 14 15:16 ad
-rw-------. 1 root root 1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root 4096 1月 14 14:49 a_test1_bak
-rw-r--r--. 1 root root 391 1月 11 18:16 a.txt
drwxr-xr-x. 2 root root 4096 1月 12 08:43 b
drwxr-xr-x. 2 root root 4096 1月 12 10:20 c
d---------. 2 root root 4096 1月 12 16:03 d
drwxr-xr-x. 2 root root 4096 1月 12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root 391 1月 12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月 12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月 13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root 391 1月 12 13:24 yy.txt
drwxr-xr-x. 2 root root 4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root 4096 11月 22 2022 模板
drwxr-xr-x. 2 root root 4096 11月 22 2022 视频
drwxr-xr-x. 2 root root 4096 11月 22 2022 图片
drwxr-xr-x. 2 root root 4096 11月 22 2022 文档
drwxr-xr-x. 2 root root 4096 11月 22 2022 下载
drwxr-xr-x. 2 root root 4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root 4096 11月 22 2022 桌面
[root@python3 ~]#