The linux mkdir command is used to creates the specified Name of directory, requires the user who created the directory to have write permissions in the current directory, and the specified directory name cannot be a directory that is already in the current directory .
1. Command format:
mkdir [Options] Directory
2. Command function:
by MKDIR  The specified file name the named folder. The user who is creating the folder must have write permissions to the parent folder of the folder that was created. Also, the folder created cannot be associated with its parent folder The name of the file in ( "  
3. Command parameters:
-m, --mode mode, set permissions < mode > ( similar to chmod)
-p, --parents can be a path name. At this point, if some directories in the path do not yet exist plus this option , You can create multiple directories at once &NBSP;
-V,--verbose Displays information each time a new catalog is created
4. Command instance:
Example 1: Create an empty directory
Command: mkdir test1
Example 2: Creating multiple directories recursively
Command: Mkdir-p test2/test22
Example 3: Create a directory with permissions of 777:
Command: Mkdir-m 777 Test3
Output:
[[email protected] test]# mkdir-m 777 Test3[[email protected] test]# lldrwxr-xr-x 2 root root 4096 10-25 17:42 test1drwxr -xr-x 3 root root 4096 10-25 17:44 test2drwxrwxrwx 2 root root 4096 10-25 17:46 Test3[[email protected] test]#
Description: The TEST3 permission is rwxrwxrwx
Example 4: Creating a new directory displays information
Command: Mkdir-v test4
Output:
[Email protected] test]# mkdir-v test4mkdir: Directory "test4" created
Example 5: a command to create a directory structure for a project
command:MKDIR-VP scf/{lib/,bin/,doc/{info,product},logs/{info,product},service/deploy/{info,product}}
[Email protected] test]# MKDIR-VP Scf/{lib/,bin/,doc/{info,product},logs/{info,product},service/deploy/{info, Product}}mkdir: Created directory "SCF" mkdir: Created directory "Scf/lib" mkdir: Directory Created "Scf/bin" mkdir: Directory Created "Scf/doc" mkdir: Created directory "Scf/doc/info" mkdir: The directory "Scf/doc/product" mkdir: Created directory "Scf/logs" mkdir: Created directory "Scf/logs/info" mkdir: Created directory "Scf/logs/product" mkdir: Directory created "Scf/service" mkdir: Directory Created "Scf/service/deploy" mkdir: Directory Created "Scf/service/deploy/info" mkdir: Directory Created "scf/service/ Deploy/product "[[email protected] test]# tree scf/scf/|--bin|--doc| | --info| | --product|--lib|--logs| | --info| | --product|--service |--deploy |--info |--product12 directories, 0 files[[email protected] test]#
Linux common Commands (iv)-mkdir