View disk usage through the command line with diskusage.
View disk usage through the command line with diskusage.
diskusage allows the flexibility to view what you need without needing a resource-intensive GUI app. You can direct it to query the total disk, specific folders, or file type.
diskusage will be helpful when you are in need of some housecleaning on your disk by letting you apply filters for specific file types, etc. The process is quick and color-coded. Below you will find a usage guide.
$ diskusage -h
Usage:
diskusage [flags]
Examples:
1.The maximum display unit is GB: diskusage -u G
2.Only files named Doc or docx are counted:
a.diskusage -t doc,docx
b.diskusage -f ".+\.(doc|docx)$"
3.Supports color output to pipeline:
a.diskusage -c always | less -R
b.diskusage -c always | more
4.Displays a 2-level tree structure: diskusage -d 2
5.Specify the directory /usr: diskusage --dir /usr
6.Export disk usage to file: diskusage > diskusage.txt
Flags:
-a, --all display all directories; otherwise, only display folders whose usage size is not 0
-c, --color string set color output mode. optional: auto, always, ignore (default "auto")
-d, --depth int shows the depth of the tree directory structure (default 1)
--dir string directory path (default "./")
-f, --filter string regular expressions are used to filter files
-h, --help help for diskusage
-t, --type strings only count certain types of files (default all)
-u, --unit string displayed units. optional: B(Bytes), K(KB), M(MB), G(GB), T(TB) (default "M")
-v, --version version for diskusage
-w, --worker int number of workers searching the directory (default 5120)
Similar:
10 Ways to Open the Command Prompt in Windows 11
How to Check Your Hard Disk Health Using WMIC
How to Check SMART Predict Failure in Windows
How to Find Your Hard Drive On, Off, and Run Time
How to Check Drive Temperature in Windows 10 & 11
Download