1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-02 01:55:22 +02:00
tldr/pages/common/du.md

33 lines
1.3 KiB
Markdown
Raw Normal View History

# du
> Disk usage: estimate and summarize file and directory space usage.
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/du-invocation.html>.
2021-10-21 22:34:54 +02:00
- List the sizes of a directory and any subdirectories, in the given unit (B/KiB/MiB):
`du -{{b|k|m}} {{path/to/directory}}`
- List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
2025-03-12 21:05:58 +02:00
`du {{[-h|--human-readable]}} {{path/to/directory}}`
2016-01-14 21:46:56 +08:00
- Show the size of a single directory, in human-readable units:
2016-01-14 21:46:56 +08:00
2025-03-12 21:05:58 +02:00
`du {{[-sh|--summarize --human-readable]}} {{path/to/directory}}`
- List the human-readable sizes of a directory and of all the files and directories within it:
2025-03-12 21:05:58 +02:00
`du {{[-ah|--all --human-readable]}} {{path/to/directory}}`
- List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
2025-03-12 21:05:58 +02:00
`du {{[-h|--human-readable]}} {{[-d|--max-depth]}} N {{path/to/directory}}`
- List the human-readable size of all `.jpg` files in current directory, and show a cumulative total at the end:
2025-03-12 21:05:58 +02:00
`du {{[-ch|--total --human-readable]}} {{./*.jpg}}`
2024-04-29 01:11:25 +10:00
2025-03-12 21:05:58 +02:00
- List all files and directories (including hidden ones) above a certain threshold size (useful for investigating what is actually taking up the space):
2024-04-29 01:11:25 +10:00
2025-03-12 21:05:58 +02:00
`du {{[-ah|--all --human-readable]}} {{[-t|--threshold]}} {{1G|1024M|1048576K}} .[^.]* *`