1. mkdir
mkdir [选项] 目录 创建目录
参数:
-p 递归创建目录
-m 对创建的目录设置权限,-m,默认是755
2. rmdir
rmdir [选项] 目录 删除”空“目录
-p 递归删除
mkdir用法案例: 在根目录/下创建uzz目录 [[email protected] /]# mkdir uzz [[email protected] /]# ls / 12 bin data1 home lost+found opt sbin sys uzz 123 boot dev lib media proc selinux tmp var abc data etc lib64 mnt root srv usr xxl [[email protected] /]# 在uzz目录下创建xk目录,再在xk目录下创建wlgc目录 [[email protected] uzz]# mkdir -p xk/wlgc [[email protected] uzz]# ls xk [[email protected] uzz]# ls xk wlgc [[email protected] uzz]# [[email protected] 12]# mkdir -m 711 files //创建files文件夹,设置目录权限是711 [[email protected] 12]# ls -l total 4 drwx--x--x 2 root root 4096 May 4 12:43 files [[email protected] 12]# mkdir file //创建file文件夹 [[email protected] 12]# ls -l //列出详细信息 total 8 drwxr-xr-x 2 root root 4096 May 4 12:44 file drwx--x--x 2 root root 4096 May 4 12:43 files [[email protected] 12]# //可以看出,这两个文件的权限是不一样的 rmdir用法案例: [[email protected] ~]# tree uzz uzz └── xxkx └── wlgc └── xxl [[email protected] ~]# rmdir -p uzz/xxkx/wlgc rmdir: failed to remove `uzz/xxkx/wlgc‘: Directory not empty [[email protected] ~]# rmdir -p uzz/xxkx/wlgc/xxl [[email protected] ~]# ls uzz ls: cannot access uzz: No such file or directory [[email protected] ~]#
时间: 2024-12-15 20:00:14