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