1# mkdir
2
3
4## Command Function
5
6This command is used to create a directory.
7
8
9## Syntax
10
11mkdir [_-vp_] [_-m mode_] [_dirname..._]
12
13
14## Parameters
15
16**Table 1** Parameter description
17
18| Parameter     | Description                      |
19| --------- | ------------------------------ |
20| --help    | Displays the parameters supported by the **mkdir** command.   |
21| -m        | Sets the permissions on the directory to create.      |
22| -p        | Creates parent and child directories recursively.        |
23| -v        | Prints detailed information about the directory creation process.|
24| directory | Specifies the directory to create.              |
25
26
27## Usage Guidelines
28
29For the files created on the FAT file system, the file permission attributes are the same as those of the mounted nodes. Currently, the node permissions include only user read and write. The **group** and **others** permissions do not take effect.
30
31In addition, only the user read and write permissions can be modified. The read and write permissions are **rw** and **ro** only. Therefore, when the **-m** option is specified in the **mkdir** command, only **777** and **555** permissions are available for the created directory, and the execute permission does not take effect.
32
33## Note
34
35Currently, the shell does not support this command. mksh supports it. To switch to mksh, run **cd bin** and **./mksh**.
36
37## Example
38
39Run the following commands:
40
41- mkdir testpath
42
43- mkdir -m 777 testpath
44
45- mkdir -pv testpath01/testpath02/testpath03
46
47## Output
48
49Example 1: Create a directory named **testpath**.
50
51
52```
53OHOS:/tmp$ mkdir testpath
54OHOS:/tmp$ ll
55total 2
56drwxrwxrwx 1 0 0 2048 1979-12-31 00:00 testpath/
57```
58
59Example 2: Create a directory named **testpath** with specified permissions.
60
61
62```
63OHOS:/tmp$ mkdir -m 777 testpath
64OHOS:/tmp$ ll
65total 2
66drwxrwxrwx 1 0 0 2048 1979-12-31 00:00 testpath/
67```
68
69Example 3: Create directories recursively.
70
71
72```
73OHOS:/tmp$ mkdir -pv testpath01/testpath02/testpath03
74mkdir: created directory 'testpath01'
75mkdir: created directory 'testpath01/testpath02'
76mkdir: created directory 'testpath01/testpath02/testpath03'
77OHOS:/tmp$ ll
78total 2
79drwxrwxrwx 1 0 0 2048 1979-12-31 00:00 testpath01/
80OHOS:/tmp$ ll testpath01/
81total 2
82drwxrwxrwx 1 0 0 2048 1979-12-31 00:00 testpath02/
83OHOS:/tmp$ ll testpath01/testpath02/
84total 2
85drwxrwxrwx 1 0 0 2048 1979-12-31 00:00 testpath03/
86```
87