The du
command, which is short for disk usage
lets you retrieve information about disk space usage information in a specified directory. In order to customize the output according to the information you need, this command can be paired with the appropriate options or flags.
- To show the estimated size of sub-directories in the current directory:
du
- To show the estimated size of sub-directories inside a specified directory:
du {PATH_TO_DIRECTORY}
du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F
Note: This does not include an exhaustive list of options.
Short Flag | Long Flag | Description |
---|---|---|
-a |
--all |
Includes information for both files and directories |
-c |
--total |
Provides a grand total at the end of the list of files/directories |
-d |
--max-depth=N |
Provides information up to N levels from the directory where the command was executed |
-h |
--human-readable |
Displays file size in human-readable units, not in bytes |
-s |
--summarize |
Display only the total filesize instead of a list of files/directories |