GNU du Cheatsheet
#
du
estimates and reports the file space usage. It is used to display the amount of disk space used by files and directories.
Basic Usage
#
Command/Option | Example | Description |
---|
du | du | Display disk usage of the current directory and its subdirectories |
du -h | du -h | Show sizes in human-readable format (e.g., KB, MB, GB) |
du -a | du -a | Include all files, not just directories |
du -s | du -s | Display only the total for each argument |
du -c | du -c | Produce a grand total |
Specific Directories
#
Command/Option | Example | Description |
---|
du /path | du /home/user | Display disk usage for the specified path |
du -x | du -x | Stay on one file system, exclude other file systems |
Advanced Usage
#
Command/Option | Example | Description |
---|
du --max-depth=<level> | du --max-depth=2 | Limit the depth of directory traversal |
du --exclude=<pattern> | du --exclude=*.log | Exclude files matching the pattern |
du --time | du --time | Show the time of last modification of files |
This cheatsheet covers essential du
commands and options for GNU systems.