One Linux command per day (4): mkdir

Source: Internet
Author: User

1. Introduction to Commands

mkdir (Make directory creates a directory): Creates a directory if the specified directory does not exist. When you create a directory, you are asked to write permissions for the user who created the directory, and you should ensure that the new directory does not have duplicate names.

2. Usage
Usage:mkdir [options] ... Directory...
3. Options
-M,--mode= mode       Sets the permission mode (similar to chmod) instead of rwxrwxrwx minus umask-p, whereparents        creates the upper-level directory of the target directory when needed, But even if these directories already exist and are not treated as error -V,--verbose        displays information every time a new directory is created -Z,--context=ctx      sets the SELinux security environment for each directory created to CTX
4. Instance 1: Create an empty directory
mkdirlsdir1
Example 2: Create multiple catalogs at once
mkdirlsdir1  dir2  dir3
Example 3: Creating Multiple directories recursively
mkdir -P dir1/sub1/sub2[[email protected] study]# tree.└──dir1    └──sub1        └──sub23  0 files
Example 4: Create a directory with permissions of 755
mkdir 755  lsdrwxr24096 April  : Dir1
Example 5: Creating a new directory displays information
mkdir -v dir3mkdir"dir3"
Example 6: A command to create a directory structure for a project
[Email protected] study]#mkdir-VP tomcat/{bin,lib,conf,logs,webapps/{examples,docs},work}mkdir: The directory has been created"Tomcat"mkdir: The directory has been created"Tomcat/bin"mkdir: The directory has been created"Tomcat/lib"mkdir: The directory has been created"tomcat/conf"mkdir: The directory has been created"Tomcat/logs"mkdir: The directory has been created"Tomcat/webapps"mkdir: The directory has been created"Tomcat/webapps/examples"mkdir: The directory has been created"Tomcat/webapps/docs"mkdir: The directory has been created"tomcat/work"[email protected] study]# Tree.└──tomcat├──bin├──conf├──lib├──logs├──webapps│├──doc S│└──examples└──work

One Linux command per day (4): mkdir

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.