2014-02-10 20:27:59 +00:00
|
|
|
# du
|
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
> Disk usage: estimate and summarize file and directory space usage.
|
2021-08-23 20:33:24 +01:00
|
|
|
> More information: <https://ss64.com/osx/du.html>.
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2021-10-21 21:34:54 +01:00
|
|
|
- List the sizes of a directory and any subdirectories, in the given unit (KiB/MiB/GiB):
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -{{k|m|g}} {{path/to/directory}}`
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
- List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -h {{path/to/directory}}`
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Show the size of a single directory, in human-readable units:
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -sh {{path/to/directory}}`
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
- List the human-readable sizes of a directory and of all the files and directories within it:
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -ah {{path/to/directory}}`
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
- List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -h -d {{N}} {{path/to/directory}}`
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
- List the human-readable size of all `.jpg` files in subdirectories of the current directory, and show a cumulative total at the end:
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2021-10-11 21:39:51 +01:00
|
|
|
`du -ch {{*/*.jpg}}`
|