Linux commands (13) Create directory mkdir Delete directory RmDir

Source: Internet
Author: User
Tags create directory

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.