Discovery flags
Discovery flags control where and how nodehunter walks the filesystem. They apply to scan, size, delete, list, find, why, and inspect.
For output, cache, and confirmation flags, see Global flags.
Quick reference
| Short | Long | Purpose |
|---|---|---|
-p | --path | Scan root (overrides [path]) |
-D | --max-depth | Max traversal depth |
-i | --ignore | Skip basename — literal or re:<regex> (repeatable) |
-nd | --no-ignore-defaults | Disable built-in ignore list |
-L | --follow-symlinks | Follow directory symlinks while scanning |
Scan root
nodehunter scan ~/work
nodehunter scan -p ~/work
nodehunter size --path .-p / --path overrides the optional [path] positional argument. Prefer a scoped directory over your entire home folder.
Depth
nodehunter scan ~/monorepo -D 3
nodehunter size ~/monorepo --max-depth 5-D / --max-depth caps how deep the walker descends before looking for node_modules. Useful in large monorepos or shallow audits.
Ignore directories
Skip directory basenames during traversal (not full paths). Repeat -i / --ignore for multiple patterns.
Literal names match exactly:
nodehunter scan ~/proj -i vendor -i .turboRegex uses the re: prefix:
nodehunter scan ~/proj -i 're:.*cache.*'
nodehunter scan ~/proj -i 're:^\\..*' # dot-directories
nodehunter size ~/proj -i 're:^dist$' -i vendorQuote regex patterns in shell — backslashes are often required for ^ and . anchors.
Built-in defaults
These basenames are always skipped unless you pass -nd / --no-ignore-defaults:
| Basename |
|---|
.git |
.cache |
.pnpm-store |
.cargo |
.Trash |
nodehunter scan ~/proj -nd -i .git # include .git in traversal rules yourselfOn Linux and WSL, absolute prefixes such as /proc, /sys, /dev, and /run are never entered.
Symlinks
nodehunter scan ~/proj -L
nodehunter scan ~/proj --follow-symlinks-L affects discovery only. Size measurement stays aligned with du and does not follow symlink directories.
Recipes
Audit a monorepo (shallow)
nodehunter size ~/company -D 4 --fullSkip tooling caches but keep everything else
nodehunter scan ~/proj -i .turbo -i .next -i vendorIgnore all dot-directories except your scan root
nodehunter scan ~/proj -i 're:^\\..*'CI: JSON discovery on a fixed path
nodehunter size ./repos -D 6 --json --silentGotchas
- Basename only —
-i vendorskips any directory namedvendor, notapps/vendor/foo. - Shell escaping — prefer single quotes around
re:patterns; test withscanbeforedelete. - No matches — widen
--path, increase--max-depth, or try--no-ignore-defaultsif defaults hide trees you need. - Symlinks — discovery with
-Lmay list more paths thansizeattributes to the same physical storage.