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.
|
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 the given unit (B/KB/MB):
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -{{b|k|m}} {{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}}`
|
2016-01-14 13:46:56 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
- Show the size of a single directory, in human readable units:
|
2016-01-14 13:46:56 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -sh {{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 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:
|
2014-02-10 20:27:59 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`du -h --max-depth=N {{path/to/directory}}`
|
2016-09-10 12:18:28 +01:00
|
|
|
|
2019-02-11 18:00:49 +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:
|
2016-09-10 12:18:28 +01:00
|
|
|
|
|
|
|
`du -ch */*.jpg`
|