Skip to main content

Crate ktop

Crate ktop 

Source
Expand description

§ktop

ktop is a Linux process monitor and process-action tool. It ships as a binary that can run either as a full terminal UI or as a non-interactive CLI helper for grep, anomaly inspection, and targeted process signals.

§Install

cargo install ktop

§TUI Mode

ktop

The TUI uses the built-in Scrin renderer and Aisling effects layer. Scrin keeps a frame diff and reuses frame buffers, while Aisling provides sparse color/effect pulses that avoid repainting the whole terminal.

Useful keys:

  • / opens spotlight grep.
  • T toggles process tree mode.
  • A toggles anomaly mode.
  • s opens the signal palette.
  • K confirms SIGTERM for the selected process.
  • e toggles visual effects.

Mouse support is enabled in the TUI:

  • Hover over a row for quick actions.
  • Left click selects a process.
  • Right click opens the signal palette.
  • Middle click opens confirmed SIGTERM.

§CLI Fast Paths

These commands do not initialize the TUI, which makes them useful on loaded systems, degraded terminals, and scripts:

ktop --grep 'cmd:python user:root'
ktop --anomalies --limit 20
ktop --kill 'cmd:firefox' --signal TERM
ktop --kill 1234 --signal KILL --yes
ktop --version
ktop --diagnostics
ktop --stability-check --samples 120 --interval-ms 500

--kill accepts either a PID/comma-separated PID list or a spotlight query. It asks for confirmation unless --yes is provided and sends signals directly with libc::kill.

§Resource Bounds

Long-running TUI state is bounded: histories use capped ring buffers, Scrin frame buffers are capped, spotlight input and parsed query tokens have explicit limits, process and CPU samples have hard caps, command-line reads from /proc and retained process metadata strings have byte caps, and cached process metadata is evicted when a PID/start-time pair is no longer present in the current /proc snapshot. ktop --diagnostics prints the live process/sample counts and configured resource caps plus cap-hit state, while ktop --stability-check reports RSS, cap-hit state, and cache high-water marks across repeated bounded samples.

§Spotlight Query Language

Plain tokens match PID, user, process name, and command line. Field tokens include user:root, name:ssh, cmd:python, pid:123, ppid:1, uid:1000, state:R, cpu>20, mem<10, age>2h, and !token negation.

§Platform

ktop currently targets Linux and reads process data from /proc.

§Library API

This crate is published primarily as a binary application. The library target exists to provide docs.rs documentation for the installed command.

Constants§

VERSION
The package version published to crates.io.