Ask your Linux system why.
Explain where things came from, what owns them, what depends on them, and what your machine is doing with them.
$ why git
╭─ WHY ───────────────────────────────────────────────────────────────╮
│ git │
│ Type: software package / command │
├─ WHAT IS THIS? ────────────────────────────────────────────────────┤
│ Tracks changes to files and manages Git repositories. It is │
│ provided by the git-2.55.0 package. │
├─ WHY IS IT HERE? ──────────────────────────────────────────────────┤
│ It is present because your Nix configuration declares it directly. │
├─ DETAILS ──────────────────────────────────────────────────────────┤
│ Package git-2.55.0 │
│ Comes from Declarative Nix configuration │
│ Declared in /etc/nixos/configuration.nix:257 │
╰────────────────────────────────────────────────────────────────────╯
Most queries do not need a subcommand.
why git
why :8080
why 4312
why ./Cargo.toml
why HOME
why thiswhy works out what kind of thing you gave it and follows the evidence
available on the machine.
$ why :8123
8123
port 8123 is currently listening
Protocol tcp
Local address 127.0.0.1:8123
Process python3
PID 4312
Executable /nix/store/...-python3-3.14.7/bin/python3.14
Provided by python3-3.14.7
| Subject | Example | What why explains |
|---|---|---|
| Package | why git |
provider, declaration, referrers, impact |
| Command | why command git |
executable path and package owner |
| Service | why service docker |
state, unit file, reverse relationships |
| Process | why 4312 |
command, package, project, ancestry |
| Port | why :8080 |
listener, PID, executable, package |
| File | why ./config.kdl |
canonical path, owner, Git provenance |
| Environment | why HOME |
current value and possible source |
| Shell | why fetch |
alias or function definition and source |
| Builtin | why cd |
what it does and why the shell implements it directly |
| Project | why this |
repo, stack, live processes, listening ports |
Explicit resolvers remain available when a name is ambiguous.
why package git
why command git
why shell fetch
why env XCURSOR_THEMENormal output stays concise. --deep asks for extra evidence.
why --deep git
why --deep 4312
why --deep ./some-fileDepending on the subject, deep mode can add package dependency closures, child processes, open file descriptor counts, file ownership and permissions, or richer service state.
For scripts and tooling:
why --json git
why --plain gitEvery structured fact includes whether it is confirmed or inferred.
why --report git > why-report.mdReports are Markdown and are designed for GitHub issues. Home paths and credential-like values are scrubbed before output.
Run without installing:
nix run github:aethctl/why -- gitInstall into your profile:
nix profile install github:aethctl/whycargo install --git https://github.com/aethctl/why why-linuxgit clone https://github.com/aethctl/why
cd why
nix develop
cargo build --releaseNixOS and Arch Linux are the first-class package targets for v0.1.
Generic Linux resolvers such as processes, ports, files, systemd services, environment variables and project context work independently where their underlying system interfaces are available.
why is intentionally read-only.
It does not repair, remove, disable, or rewrite your system. Its job is to explain what is there and show the evidence behind that explanation.
The project follows a few rules:
- evidence before guesses
- concise output by default
- inferred claims are labelled
- distro-specific behavior lives behind shared concepts
- machine-readable output is a first-class interface
- sensitive values do not belong in bug reports
nix develop
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets --all-features
nix buildMIT