I. Introduction to the establishment of a directory mkdir command
The mkdir command is used to create the specified directory. When you create a directory, the current user has read access to the directory where the action is required. If the directory already exists, it will prompt an error and launch. MkDir can create multi-level catalogs.
Common parameter Description
-m 设置新目录的存取权限,类似于 chmod-p 该参数后跟一路径名称,可以是绝对路劲或向对路径,如目录不存在则会创建--help 显示帮助信息
The destination path cannot have a directory or file with duplicate names when creating the directory. Use -p
parameters to create multiple catalogs at once, and
You can create multi-level catalogs, and two do not require each directory in a multilevel directory to exist.
Instance
mkdir soft 创建新目录mkdir -p soft/abc 创建多级目录mkdir -m775 soft 指定新建目录的权限mkdir -p data/dira data/dirb 一次创建多个目录mkdir -p data/{dira,dirb} 一次创建多个目录
Ii. Introduction to the Delete directory RmDir command
The RmDir directory is used to delete the specified directory, and the deleted directory must be an empty directory or a multilevel empty directory.
Common parameter Description
--ignore-fail-on-non-empty 忽略数据存在目录非空产生的错误-p 递归删除各级目录--help 显示帮助信息
If -p
the parameter is used, it is mkdir -p a/b/c
equivalent to rmdir a/b/c rmdir /a/b rmdir /a
. If there are empty directories and files in the directory, the empty directory is deleted and the previous directory cannot be deleted.
Instance
rmdir dira 删除目录mkdir -p a/b/c 递归删除目录
Linux commands (13) Create directory mkdir Delete directory RmDir