Disk analyzer
dkit analyze # the current folder
dkit analyze ~ # your home folder
dkit analyze /Volumes/Backup
An explorer that lists everything in a folder, largest first, with the share of space each entry takes. Open a folder to see inside it and work your way down to whatever is filling the disk.
The folder is listed at once and its sizes fill in while the count runs, so the largest entries rise to the top within moments. You can move around and open folders without waiting for it to finish.
| Key | Action |
|---|---|
↑ ↓ or k j |
Move |
enter or → |
Open the selected folder |
← or backspace |
Go to the parent folder |
f or tab |
Switch between folders and the largest files |
r |
Count everything again |
esc |
Stop a count that is running, keeping what it found |
q |
Quit |
A size followed by + is not final: more may be added to it. That is every unfinished folder while the count runs, and whatever was unfinished if you stopped it. … means nothing has been counted there yet.
One count covers the folder you started in and everything below it, so opening any folder inside is immediate. Going above the starting folder starts a new count. The largest-files view belongs to the folder being shown.
Counting uses up to half of the processor’s cores, six at most, so the machine stays usable while a large folder is read.
The analyzer only reads. It never changes or removes anything.
What clean or purge covers
An entry that a cleanup command knows about carries a mark after its name:
| Mark | Meaning |
|---|---|
clean: app-caches |
The cleanup rule app-caches covers this entry |
clean: xcode-derived-data, off |
A rule covers it, but that rule is off by default and only runs with --include |
purge: node-modules |
It is a build folder of that kind, with the proof purge asks for |
In the explorer, the line above the keys says what the mark on the highlighted entry means.
A mark means covered, not “would be removed now”. A rule can be off by default, wait until files are a week old, or skip a cache whose app is running. A build folder is only selected when its project has been idle for 30 days. Your keep list wins over all of it. The command’s own preview is what says what would go:
dkit clean --dry-run # for a `clean:` mark
dkit clean --include <rule> --dry-run # for one marked `off`
dkit purge <folder> --dry-run # for a `purge:` mark; the folder that holds the project
- The marks come from the same code that plans a clean or a purge: the rules’ own paths and exclusions, the limits on what can never be cleaned, the purge kinds and their proof, and where purge may go. There is no second list.
- Only the entry itself is judged.
~/Library/Cacheshas no mark; the folders inside it do. - Nothing in a protected place is ever marked, and neither is a symbolic link or a build folder in a synced folder.
- Marking costs no extra pass over the disk. Each entry of the folder on screen is checked once when the folder is opened, by its path, and only a folder with a build folder’s name has its proof looked up.
- Installers and uninstall are not marked.
One-off report
dkit analyze ~/Downloads --plain
dkit analyze . --plain --limit 30 # list more entries (default 15)
dkit analyze . --plain --top-files 20
dkit analyze . --json # every entry, for scripts
With --json, a covered entry has covered_by: command (clean or purge), id (the rule or kind), name, and on_by_default. Entries nothing covers have no such field. The text report explains the marks under the list whenever it shows one.
How sizes are measured
- Sizes are the space a file takes on disk, which can differ from its length (sparse and compressed files).
- A file with several hard links is counted once in totals. In the explorer each of its names shows the full size, so rows can add up to slightly more than the folder’s total.
- Symbolic links are never followed, so a link to a large folder elsewhere adds nothing.
- Entries that cannot be read, usually for lack of permission, are counted and reported rather than silently skipped.
From docs/commands/analyze.md at v0.1.0-alpha.2.