du: rework page, add glob matching example (fixes #1032) (#1034)

* fixup: remove excess whitespace

* du: various tweaks

- improve main description (include what "du" stands for)
- simplify globbing example
- unify nomenclature of folder/directory
- minor tweaks to existing descriptions

* du: a bunch of further rewordings

these changes aim to improve both clarity but also the sequence of commands to make it easier to build a mental model of how the tool works.

* osx/du: sync w/ changes in the linux folder

* linux/du: sync w/ changes in the osx folder

* remove slighly redundant «recursively» to make description simpler
This commit is contained in:
Waldir Pimenta 2016-09-10 12:18:28 +01:00 committed by GitHub
parent ed012db814
commit 62d4d4816f
2 changed files with 31 additions and 19 deletions

View File

@ -1,23 +1,27 @@
# du
> Estimate file space usage.
> Disk usage: estimate and summarize file and folder space usage.
- Get a sum of the total size of a file/folder in human readable units:
- List the sizes of a folder and any subfolders, in the given unit (B/KB/MB):
`du -sh {{file_or_directory}}`
`du -{{b|k|m}} {{path/to/folder}}`
- List file sizes of a directory and any subdirectories in KB:
- List the sizes of a folder and any subfolders, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
`du -k {{file_or_directory}}`
`du -h {{path/to/folder}}`
- List file sizes of a directory and any subdirectories in MB:
- Show the size of a single folder, in human readable units:
`du -m {{file_or_directory}}`
`du -sh {{path/to/folder}}`
- Get recursively, individual file/folder sizes in human readable form:
- List the human-readable sizes of a folder and of all the files and folders within it:
`du -ah {{directory}}`
`du -ah {{path/to/folder}}`
- List the KB sizes of directories for N levels below the specified directory:
- List the human-readable sizes of a folder and any subfolders, up to N levels deep:
`du --max-depth=N`
`du -h --max-depth=N {{path/to/folder}}`
- List the human-readable size of all .jpg files in subfolders of the current folder, and show a cumulative total at the end:
`du -ch */*.jpg`

View File

@ -1,19 +1,27 @@
# du
> Estimate file space usage.
> Disk usage: estimate and summarize file and folder space usage.
- Get a sum of the total size of a file/folder in human readable units:
- List the sizes of a folder and any subfolders, in the given unit (KB/MB/GB):
`du -sh {{path/to/file_or_folder}}`
`du -{{k|m|g}} {{path/to/folder}}`
- List file sizes of a directory and any subdirectories in KB:
- List the sizes of a folder and any subfolders, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
`du -k {{path/to/file_or_folder}}`
`du -h {{path/to/folder}}`
- Get recursively, individual file/folder sizes in human readable form:
- Show the size of a single folder, in human readable units:
`du -sh {{path/to/folder}}`
- List the human-readable sizes of a folder and of all the files and folders within it:
`du -ah {{path/to/folder}}`
- List the human-readable sizes of directories for 2 levels of depth below the specified directory:
- List the human-readable sizes of a folder and any subfolders, up to N levels deep:
`du -h -d 2 {{path/to/folder}}`
`du -h -d {{N}} {{path/to/folder}}`
- List the human-readable size of all .jpg files in subfolders of the current folder, and show a cumulative total at the end:
`du -ch */*.jpg`