1e41f4b71Sopenharmony_ci# du
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Command Function
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciThis command is used to query the disk space occupied by a file.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Syntax
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_cidu [_-kKmh_] [_file..._]
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci## Parameters
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**Table 1** Parameter description
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci| Parameter  | Description                                                    |
19e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ |
20e41f4b71Sopenharmony_ci| --help | Displays the parameters supported by the **du** command.                                  |
21e41f4b71Sopenharmony_ci| -k     | Displays the occupied blocks, each of which is 1024 bytes by default.                       |
22e41f4b71Sopenharmony_ci| -K     | Displays the occupied blocks, each of which is 512 bytes (POSIX).                   |
23e41f4b71Sopenharmony_ci| -m     | Displays the disk space in MB.                                              |
24e41f4b71Sopenharmony_ci| -h     | Displays the disk space in human-readable format K, M, and G, for example, **1K**, **243M**, or **2G**.|
25e41f4b71Sopenharmony_ci| file   | Specifies the target file.                                      |
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci## Usage Guidelines
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci- The **du** command is used to obtain the disk usage of a file rather than a directory.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci- The value of **file** must be the file name. It cannot contain the directory where the file is located.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci## Note
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ciCurrently, the shell does not support this command. mksh supports it. To switch to mksh, run **cd bin** and **./mksh**.
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci## Example
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ciRun **du -h testfile**.
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci## Output
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ciDisk space occupied by **testfile**.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci```
48e41f4b71Sopenharmony_ciOHOS:/$ du -h testfile
49e41f4b71Sopenharmony_ci1.8K    testfile
50e41f4b71Sopenharmony_ci```
51