2014-02-10 12:27:59 -08:00
|
|
|
# du
|
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
> Disk usage: estimate and summarize file and directory space usage.
|
2021-08-23 22:33:24 +03:00
|
|
|
> More information: <https://ss64.com/osx/du.html>.
|
2014-02-10 12:27:59 -08:00
|
|
|
|
2021-10-21 22:34:54 +02:00
|
|
|
- List the sizes of a directory and any subdirectories, in the given unit (KiB/MiB/GiB):
|
2014-02-10 12:27:59 -08:00
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
`du -{{k|m|g}} {{path/to/directory}}`
|
2014-02-10 12:27:59 -08:00
|
|
|
|
2019-02-11 19:00:49 +01: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 12:27:59 -08:00
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
`du -h {{path/to/directory}}`
|
2014-02-10 12:27:59 -08:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Show the size of a single directory, in human-readable units:
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
`du -sh {{path/to/directory}}`
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
- List the human-readable sizes of a directory and of all the files and directories within it:
|
2014-02-10 12:27:59 -08:00
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
`du -ah {{path/to/directory}}`
|
2014-02-10 12:27:59 -08:00
|
|
|
|
2019-02-11 19:00:49 +01: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
|
|
|
|
2023-02-20 17:05:58 +10:00
|
|
|
`du -h -d {{2}} {{path/to/directory}}`
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2021-01-31 14:05:18 -03: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 12:27:59 -08:00
|
|
|
|
2021-10-11 17:39:51 -03:00
|
|
|
`du -ch {{*/*.jpg}}`
|