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