mkdir command details and how to use the actual combat
Name
MKDIR is the abbreviation for make directories
How to use
mkdir [option (e.g.-P)] ... Directory name (and subdirectory note separated by delimiter) ... Use the-P command to create a multilevel directory using mkdir
Such as:
MKDIR/LCP is to create a folder named LCP under the root (/) directory
Mkdir-p/LCP/ABC is to build a folder named LCP in the root (/) directory and create a folder named ABC in this folder.
Describe
Create a directory (IES) if they do not exist.
The parameters that must be used for the long option are also required when using the short option.
-m,--mode = mode
Set file mode (with chmod) instead of = RWX-Umask
-p,--parents
When you create a new multilevel directory, this is used as a key command, the-p parameter can follow a path such as Mkdir-p/lcp/abc/vanos if there is a directory that does not exist in the middle, the system automatically complements the missing directory, that is, to establish a multi-level nonexistent directory when used.
-v,--verbose
Print a message for each directory that is created, the popular point is to show the directory new process.
-z,--context = CTX
Set the SELinux security context for each created directory
CTX
Do not understand the content can use MKDIR--HELP or use the Man command to view the details, through the mkdir command to create a folder or directory in the specified location, note that the current user to create the files and folders must be created for the folder's parent folder has write permissions.
Demo: In the root directory, create a new empty directory of data.
1 [[email protected] ~]# mkdir/Data New Data folder 2 [[email protected] ~]# cd/data/ We go to this folder 3[[email protected] data]# pwd Check the current directory (PWD view current path)4 /data View the result of the command execution, indicating that we are currently in the data directory under the root (/)
Create a new multilevel directory (assuming the directory does not exist)
1[Email protected] ~]# mkdir- P/lcp/abc/Vanos Create a new multilevel directory/lcp/abc/vanos use the- p command here2[[email protected] ~]# tree/lcp/Use the tree command to view the/lcp/folder that contains those subdirectories tree command here's a list of trees listing contents3/lcp/4 â "" "€â" €abc5 â "" "€â" €vanos here because is the use of the CRT remote connection, the display character is wrong, here is also listed here, the following is a temporary solution, can use the use of less than the need to understand, the future content will have a detailed explanation here only needles For Beginners 6 7 2Directories,0Files8[Email protected] ~]# lang=en solutions are directly typed lang=en Note,Lang uppercase, Linux in case sensitive, must be rigorous 9[[email protected] ~]# tree/lcp/here we'll check it out, tree/lcp/Some students will ask, this "/lcp/" I do not add "/" direct "/LCP" can not? This is also possible, but in order to be rigorous we add "/", which means to view the contents of the LCP directoryTen/lcp/ One`--ABC A`--Vanos All right, here's the list. LCP under the bread with an ABC folder, there is a Vanos subdirectory
- - 2Directories,0Files shows two directories, 0 files
Here is the tree command to mention, if the system was installed when the tree did not choose what to do? Use the Yum command to install the tree feature
1 [[email protected] ~]# Yum install tree-y yum install back with the package/package group name that needs to be installed--- -y stands for consent to the installation meaning, if not plus-y You will be asked to confirm the use of this information only for details prior to installation www.baidu.com
mkdir deeper Establishment is-m/-V, the contents of the content including permissions, and later will be explained, for beginners do not have to do too much understanding, slow and steady is the hard truth. Hands-on, multi-practice. Linux is actually very simple.
Linux mkdir command details and how to use the actual combat "beginner"