Skip to content

jondot/pk

Repository files navigation

pk

Process killer for devs and AI. Fast, cross-platform, JSON-friendly.

pk is a single binary that kills, lists, checks, and waits on processes — by PID, name, or port. It's built for developers and AI agents (like Claude Code) that need reliable process management with structured output.

pk interactive mode

Install

cargo install pk

Or via npm:

npm i -g @jondot/pk

Or download a prebuilt binary from GitHub Releases:

# macOS (Apple Silicon)
curl -fsSL https://github.com/jondot/pk/releases/latest/download/pk-aarch64-apple-darwin.tar.gz | tar xz
sudo mv pk /usr/local/bin/

# Linux (x64)
curl -fsSL https://github.com/jondot/pk/releases/latest/download/pk-x86_64-unknown-linux-gnu.tar.gz | tar xz
sudo mv pk /usr/local/bin/

# Linux (ARM64)
curl -fsSL https://github.com/jondot/pk/releases/latest/download/pk-aarch64-unknown-linux-gnu.tar.gz | tar xz
sudo mv pk /usr/local/bin/

Usage

Run without arguments for an interactive TUI:

pk

Kill processes

# By PID
pk kill 1234

# By name (fuzzy match)
pk kill node

# By port
pk kill :3000

# Multiple targets
pk kill :3000 :8080 node

# Force kill (SIGKILL)
pk kill -f 1234

# Dry run
pk kill --dry-run node

# Structured JSON output
pk kill --json :3000

List processes

pk list
pk list node
pk list --json
pk list --json node

Check if a process or port exists

pk check 1234
pk check node
pk check :3000
pk check --json :3000

Kill a process tree

pk tree 1234
pk tree --json 1234

Wait for a process to exit or port to free

pk wait 1234 --timeout 30
pk wait :3000 --timeout 10
pk wait --json :3000

AI and automation

Every subcommand supports --json for structured output, making pk easy to use from AI agents, scripts, and CI pipelines:

$ pk check --json :3000
{"exists":true,"pid":1234,"name":"node","ports":[3000],"listening":true}

$ pk kill --json :3000
{"killed":[{"pid":1234,"name":"node","ports":[3000]}],"failed":[],"not_found":[]}

$ pk list --json node
[{"pid":1234,"name":"node","ports":[3000],"cpu":2.1,"memory":1.5}]

Use --silent to suppress errors and always exit 0 — useful when cleaning up processes that may or may not exist:

pk kill --silent :3000

Claude Code integration

Install the pk plugin to teach Claude Code to use pk for process management. Run these commands inside Claude Code:

/plugin marketplace add jondot/pk
/plugin install pk

Once installed, Claude Code will automatically use pk instead of lsof, kill, and ps when managing processes in your projects.

Global flags

Flag Description
--json Output as compact JSON
-f, --force SIGKILL instead of SIGTERM
-v, --verbose Show process arguments
-s, --silent Suppress errors, always exit 0
--dry-run Show what would happen
-t, --force-after-timeout N Escalate to SIGKILL after N seconds
--smart-case Case-insensitive unless pattern has uppercase
--case-sensitive Force case-sensitive matching
-x, --exclude NAME Exclude processes by name (repeatable, comma-separated)

Interactive mode

Running pk without arguments opens a TUI with:

  • Fuzzy search across process names, PIDs, and ports
  • Port filtering with : prefix (e.g. type :3000)
  • CPU and memory usage display
  • Process detail panel (PID, ports, executable path, working directory, uptime)
  • Sort cycling (Ctrl+O): default, name, PID, port, memory, uptime
  • Single kill (Enter) with confirmation
  • Batch kill (Ctrl+Enter) with safety phrase for large selections

License

MIT

About

Process killer for devs and AI. Fast, cross-platform, JSON-friendly.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors