Features: - Browse all loaded kernel modules from /proc/modules - Two-pane layout: scrollable list + detail pane - Full-screen detail view with modinfo, parameters, holders - Vim-style navigation (j/k, Enter, /, s, r, ?, q) - Edge-scrolling (cursor moves freely, viewport follows) - Filter by module name AND dependents (used_by) - Sort by name, size, refcnt, or dependents count - Lazy modinfo fetching (shells out only on selection) - 13 unit tests (parser, filter, scroll logic) Tech: Rust + ratatui + crossterm
96 lines
3.0 KiB
Markdown
96 lines
3.0 KiB
Markdown
# kmod-tui
|
|
|
|
A terminal UI for Linux sysadmins to browse and inspect loaded kernel modules.
|
|
Read-only — built for looking, not for changing module state.
|
|
|
|
## Why
|
|
`lsmod` shows a flat table. `modinfo <mod>` shows one module. This tool gives
|
|
you a navigable, filterable, sorted view of all loaded modules with rich
|
|
per-module detail (license, author, description, parameters, holders,
|
|
dependency info) a keystroke away.
|
|
|
|
## Data sources (read-only)
|
|
- `/proc/modules` — the loaded module list
|
|
- `/sys/module/<name>/` — refcnt, coresize, initsize, initstate, srcversion,
|
|
taint, `parameters/`, `holders/`
|
|
- `modinfo <name>` — filename, license, description, author, depends,
|
|
vermagic, retpoline, intree, signature info (fetched lazily, only when a
|
|
module is selected for detail, so the list view stays fast)
|
|
|
|
## Build & run
|
|
```sh
|
|
cargo run --release
|
|
# or
|
|
cargo build --release
|
|
./target/release/kmod-tui
|
|
```
|
|
Requires the Rust toolchain (rustup stable). No other deps; ratatui/crossterm
|
|
are vendored by cargo.
|
|
|
|
## Keys
|
|
|
|
List view:
|
|
```
|
|
j / ↓ move down
|
|
k / ↑ move up
|
|
g / Home top
|
|
G / End bottom
|
|
PgDn / PgUp scroll by 10
|
|
Enter open full-detail screen for the selected module
|
|
/ start filtering by module name (type, Esc to clear)
|
|
s cycle sort: name → size → refcnt → dependents
|
|
r refresh the module list from /proc/modules
|
|
? toggle help overlay
|
|
q quit
|
|
```
|
|
|
|
Full-detail view:
|
|
```
|
|
j / ↓ , k / ↑ move selection (stays in full-detail, reloads detail)
|
|
Esc / q back to list
|
|
? help
|
|
```
|
|
|
|
Filter mode (after `/`):
|
|
```
|
|
type append to filter
|
|
Backspace delete last char
|
|
Enter / Esc exit filter (Esc also clears)
|
|
```
|
|
|
|
## Layout
|
|
- Top bar: module count + kernel version + current sort/filter.
|
|
- Middle: scrollable module table (#, name, size, refcnt, used-by, state).
|
|
- Bottom: two-column detail pane for the highlighted module.
|
|
- Footer: key hints (context-sensitive).
|
|
|
|
## Architecture
|
|
```
|
|
src/
|
|
main.rs CLI bootstrap, event loop, key dispatch
|
|
app.rs App state: module list, cursor, filter, sort, view mode, lazy fetches
|
|
event.rs crossterm input polling
|
|
model.rs Module/ModInfo types, /proc + /sys collection, modinfo parsing, tests
|
|
ui/
|
|
mod.rs frame composition, status bar, footer, help overlay
|
|
list.rs module table
|
|
detail.rs detail pane + full-detail screen
|
|
```
|
|
|
|
## Tests
|
|
```sh
|
|
cargo test --release
|
|
```
|
|
Unit tests cover the /proc/modules `used-by` parser, the `modinfo` output
|
|
parser, and the human-readable size formatter.
|
|
|
|
## Non-goals (v1)
|
|
- Writing module parameters or loading/unloading modules — read-only by design.
|
|
- Showing all installable (not-yet-loaded) modules — planned for v1.1.
|
|
- Remote hosts — local only.
|
|
|
|
## Roadmap
|
|
- v1.1: dependency tree view, all-available-modules toggle, CSV/TSV export,
|
|
config file (`~/.config/kmod-tui/config.toml`).
|
|
- v2: optional inotify auto-refresh on `/proc/modules`.
|