dua
Analyze disk usage
TLDR
Analyze specific directory
Display apparent size instead of disk usage
Count hard-linked files each time they are seen
Aggregate the consumed space of one or more directories or files
Launch the terminal user interface
Format printing byte counts
Use a specific number of threads (defaults to the process number of threads)
SYNOPSIS
dua [OPTIONS] [PATH]
PARAMETERS
-a, --all
Show all files and directories.
-h, --human-readable
Print sizes in human-readable format (e.g., 1K 234M 2G).
-d, --depth=
Limit the depth of the directory tree to display.
-e, --exclude
Exclude files or directories that match the pattern.
-f, --file
Read directory list from FILE.
-s, --summarize
Display only the total size of each argument.
-t, --threshold
Report only directories bigger than SIZE.
-v, --version
Print version information.
-j, --json
Output results in JSON format.
--no-colors
Disable colored output.
--reverse
Reverse the sort order (smallest first).
--help
Show help message and exit.
DESCRIPTION
The dua command provides a visual and interactive way to analyze disk space usage. Unlike the standard `du` command, dua offers a more user-friendly interface, making it easier to identify large files and directories that contribute most to disk space consumption. It presents a hierarchical display of directories and files, allowing users to drill down into specific areas to pinpoint space hogs. dua is particularly useful for cleaning up disk space as it aids in quick identification of files suitable for deletion. It can be used in both interactive and non-interactive modes. dua presents the information by default in the terminal, although it can output JSON or other formats. It typically displays the sizes in a human-readable format. The tool supports various filtering options, such as excluding specific file types or directories, making the analysis more focused and efficient.
CAVEATS
dua relies on accurate file system information. If the file system is changing while dua is running, the results might be inconsistent. Be careful when analyzing large filesystems as it can be computationally expensive and memory intensive.
INTERACTIVE MODE
In interactive mode, dua presents a navigable tree structure in the terminal.
You can use the arrow keys to drill down into directories and identify the largest files.
Pressing 'd' typically marks a file or directory for deletion (though actual deletion requires additional steps, as dua by itself usually does not handle deletion).
The `Enter` key allows navigation into directories.
NON-INTERACTIVE MODE
When used with options like `--json`, dua can be incorporated into scripts and automated workflows. This is useful for generating reports or triggering actions based on disk usage patterns.
Example: dua -j /path/to/directory
.
HISTORY
dua is a relatively recent tool designed to provide a more interactive and visually appealing alternative to traditional disk usage utilities. Its development has been driven by the need for improved ease of use and efficiency in disk space management. The tool is actively maintained, with ongoing improvements to performance and features.