2015-06-25 created
1. Summary:
The Linux mkdir command creates the specified directory if these directories do not exist.
2. Command format:
mkdir [OPTION] ... DIRECTORY ... English: mkdir [options] ... Directory...
3. Common examples:
mkdir AAA Create directory under current path, directory named "AAA"
3. Common Command parameters:
-M,--mode=mode
Set file permissions (as with chmod), not rwxrwxrwx-umask, where the mode parameter can be a number or a permission symbol. Examples are as follows:
[[Email protected] data]# ls[[email protected] data]# mkdir test[[email protected] data]# mkdir --m=777 test1[[email protected] data]# mkdir --m 776 test2[[email protected] data]# mkdir -m 776 test3[[email protected] data]# mkdir -m=776 test4 # #报错 invalid Invalid mkdir: invalid mode ' =776 ' [[email protected] data]# mkdir -m " +--xrw-r-x " test5 [[email protected] data]# mkdir --m=--- Xrw-r-x test6[[email protected] data]# ls -ltotal 16drwxr-xr-x. 2 root root 4096 jun 26 03:07 testdrwxrwxrwx. 2 root root 4096 Jun 26 03:07 test1drwxrwxrw-. 2 root root 4096 Jun 26 03:07 test2drwxrwxrw-. 2 root root 4096 jun 26 03:07 test3d----W--w-. 2 root root 4096 Jun 26 03:14 test5 ## Why this result, for the time being do not understand D----w--w-. 2 root root 4096 jun 26 03:15 test6 ## Why this result, for the time being not understand
-P,--parents
When creating a directory, there is no error if the directory exists, or if the parent directory does not exist when creating a multilevel directory.
* Often used to create multi-level catalogs. examples are as follows:
[[email protected] data]# mkdir test2mkdir:cannot Create directory ' test2 ': File exists[[email protected] data]# mkdir-p Test2[[email protected] data]# mkdir aa/bb/ccmkdir:cannot Create directory ' AA/BB/CC ': No such file or Directory[[email Protected] data]# mkdir-p aa/bb/cc[[email protected] data]# tree aaaa '--BB '--CC2 directories, 0 files
-V,--verbose
Prints a piece of information for each directory you create. Examples are as follows:
[[email protected] data]# MKDIR-PV aa/dd/ee # #目录 AA to create mkdir:created directory ' aa/dd ' mkdir:created directory ' aa/ Dd/ee '
--help
Displays the help information for the current command and exits.
--version
Output version information and exit.
4. Current command location and type:
[email protected] data]# which mkdir/bin/mkdir[[email protected] data]# type Mkdirmkdir is hashed (/bin/mkdir)
This article is from the "personal blog" blog, please be sure to keep this source http://9410445.blog.51cto.com/9400445/1665694
Linux mkdir Commands