pranshuparmar/witr
witr
Why is this running?
Trace any process, port, container, or file back to the exact chain that started it โ
one command, machine-readable JSON, or an interactive TUI.
๐ฎ Try witr in your browser โ
Investigate a simulated Linux box โ a guided tutorial and free-play sandbox, no install required.
Purpose โข Installation โข TUI โข Flags โข Core Concept โข Examples
Output Behavior โข Platforms โข Success Criteria โข Sponsors
1. Purpose
witr exists to answer a single question:
Why is this running?
When something is running on a system, whether it is a process, a service, or something bound to a port, there is always a cause. That cause is often indirect, non-obvious, or spread across multiple layers such as supervisors, containers, services, or shells.
Existing tools (ps, top, lsof, ss, systemctl, docker ps) expose state and metadata. They show what is running, but leave the user to infer why by manually correlating outputs across tools.
witr makes that causality explicit.
It explains where a running thing came from, how it was started, and what chain of systems is responsible for it existing right now, in a single, human-readable output or an interactive TUI dashboard.
๐ Curious how witr came to be? Read the story or browse the Hacker News discussion.
2. Installation
witr is distributed as a single static binary for Linux, macOS, FreeBSD, and Windows.
witr is also independently packaged and maintained across multiple operating systems and ecosystems. An up-to-date overview of packaging status is available on Repology. Please note that community packages may lag GitHub releases due to independent review and validation.
[!TIP] If you use a package manager (Homebrew, Conda, Winget, etc.), we recommend installing via that for easier updates. Otherwise, the install script is the quickest way to get started.
2.1 Quick Install
Unix (Linux, macOS & FreeBSD)
|
|
Script Details
The script will:
- Detect your operating system (
linux,darwinorfreebsd) - Detect your CPU architecture (
amd64orarm64) - Download the latest released binary and man page
- Install it to
/usr/local/bin/witr - Install the man page to
/usr/local/share/man/man1/witr.1 - Pass INSTALL_PREFIX to override default install path
Windows (PowerShell)
|
|
Script Details
The script will:
- Download the latest release (zip) and verify checksum.
- Extract
witr.exeto%LocalAppData%\witr\bin. - Add the bin directory to your User
PATH.
2.2 Package Managers
APT (Debian, Ubuntu & Derivatives) 
You can install witr from the official Debian and Ubuntu repositories (Ubuntu 26.04+, Debian sid and later), as well as derivative distributions like Kali Linux, Devuan, and Raspbian:
|
|
Note: The apt-shipped version may lag the latest GitHub release. For the newest features, use the install script or another installation method.
Conda (macOS, Linux & Windows) 
You can install witr using conda, mamba, or pixi on macOS, Linux, and Windows:
|
|
Arch Linux (AUR) 
On Arch Linux and derivatives, install from the AUR package:
|
|
FreeBSD Ports 
You can install witr on FreeBSD from the FreshPorts port:
|
|
Or build from Ports:
|
|
Aqua (macOS, Linux & Windows) 
You can install witr using aqua:
|
|
Prebuilt Packages (deb, rpm, apk)
witr provides native packages for major Linux distributions. You can download the latest .deb, .rpm, or .apk package from the GitHub releases page.
-
Generic download command using
curl:1 2# Replace <package name with the actual package that you need> curl -LO https://github.com/pranshuparmar/witr/releases/latest/download/<package-name> -
Debian/Ubuntu (.deb):
1 2 3sudo dpkg -i ./witr-*.deb # Or, using apt for dependency resolution: sudo apt install ./witr-*.deb -
Fedora/RHEL/CentOS (.rpm):
1sudo rpm -i ./witr-*.rpm -
Alpine Linux (.apk):
1sudo apk add --allow-untrusted ./witr-*.apk
2.3 Source & Manual Installation
Go (cross-platform)
You can install the latest version directly from source:
|
|
This will place the witr binary in your $GOPATH/bin or $HOME/go/bin directory. Make sure this directory is in your PATH.
Manual Installation
If you prefer manual installation, follow these simple steps for your platform:
Unix (Linux, macOS, FreeBSD)
|
|
Windows (PowerShell)
|
|
2.4 Run Without Installation
Nix Flake
If you use Nix, you can build witr from source and run without installation:
|
|
2.5 Other Operations
Verify Installation
|
|
Shell Completions
witr supports tab completion for all flags. To enable it, add the appropriate line to your shell configuration:
Bash
|
|
Zsh
|
|
Fish
|
|
PowerShell
|
|
Uninstallation
If you installed via a package manager (Homebrew, Conda, etc.), please use the respective uninstall command (e.g., brew uninstall witr).
To completely remove script/manual installation of witr:
Unix (Linux, macOS, FreeBSD)
|
|
Windows
|
|
3. Interactive Mode (TUI)
Running witr without any arguments or with the -i flag launches the Interactive Mode (TUI). This provides a real-time, terminal-based dashboard with four tabs for exploring processes, ports, containers, and file locks.
Key Features:
- Processes Tab: Live, sortable, filterable list of all running processes with a side panel showing the ancestry tree of the highlighted process.
- Ports Tab: Open/listening ports with the owning processes attached in a side panel. Toggle between LISTEN-only and ALL with
a. - Containers Tab: All running containers across Docker, Podman, nerdctl, K8s/crictl, Incus, LXC, LXD, and FreeBSD jails in one list - name, image, status, ports, command, plus a per-container detail view with mounts, networks, and compose project metadata.
- Locks Tab: System-wide file locks (POSIX/FLOCK on Linux, lsof-derived on macOS/FreeBSD). Press
ato switch into “all open files” mode, where locked entries are merged with every interesting open fd; type into/to search across the merged set. - Process Details: Deep-dive into a process to see its full ancestry tree, child processes, environment variables, working directory, sockets, file context, and more.
- Process Actions: Send signals (Kill, Terminate, Pause, Resume) or Renice processes directly from the UI (Unix only).
- Mouse Support: Navigate, sort columns, and click rows using your mouse.
- Adaptive Theme: Colors adapt automatically to light and dark terminal backgrounds.
- Auto-Refresh: The process, port, container, and lock lists refresh automatically on an adaptive cadence (starts at 3 seconds, backing off under load).
4. Flags & Options
|
|
Positional arguments (without flags) are treated as process or service names. Multiple names can be passed. By default, name matching uses substring matching (fuzzy search). Use --exact to match only processes with the exact name.
All target flags (--pid, --port, --file, --container) are repeatable and can be mixed with each other and with positional name arguments. When multiple targets are provided, results are shown sequentially with labeled dividers. All output modes (standard, short, tree, JSON, env, warnings, verbose) work with multiple inputs.
The --container flag searches across Docker, Podman, nerdctl, K8s/crictl, Incus, LXC, LXD, and FreeBSD jails, and matches against container name, image, command, and compose project/service labels.
The TUI is launched if no arguments or relevant flags (--pid, --port, --file, --container) are provided, or if the --interactive flag is explicitly used.
5. Core Concept
witr treats everything as a process question.
Ports, services, containers, and commands all eventually map to PIDs. Once a PID is identified, witr builds a causal chain explaining why that PID exists.
At its core, witr answers:
- What is running?
- How did it start?
- What is keeping it running?
- What context does it belong to?
6. Example Outputs
๐ก Prefer learning by doing? The interactive browser tutorial walks you through outputs like these live on a simulated box โ for a better feel of witr, no install required.
6.1 Name Based Query
|
|
|
|
6.2 Short Output
|
|
|
|
6.3 Tree Output
|
|
|
|
Note: Tree view includes child processes (up to 10) and highlights the target process.
6.4 Multiple Matches
|
|
|
|
To avoid substring matching and only find processes with an exact name, use the --exact flag:
|
|
6.5 File Based Query
|
|
Explains the process holding a file open.
6.6 Container Based Query
|
|
Looks up a container by name, image, command, or compose project/service across every detected runtime (Docker, Podman, nerdctl, K8s/crictl, Incus, LXC, LXD, FreeBSD jails). Pass --verbose to include mounts, networks, and compose metadata in the output.
6.7 Multiple Inputs
|
|
|
|
All target flags are repeatable and can be mixed. Results appear in the order you typed them. All output modes (--short, --tree, --json, --env, --warnings, --verbose) work with multiple inputs.
7. Output Behavior
7.1 Output Principles
- Single screen by default (best effort)
- Deterministic ordering
- Narrative-style explanation
- Best-effort detection with explicit uncertainty
7.2 Exit Codes
witr returns meaningful exit codes for use in scripts, CI pipelines, and monitoring:
| Code | Meaning |
|---|---|
| 0 | Clean: process found, no warnings |
| 1 | Warnings: process found but has one or more warnings |
| 2 | Not found: no matching process or service |
| 3 | Permission denied: insufficient privileges |
| 4 | Invalid input: bad arguments or ambiguous match |
| 5 | Internal error: an unexpected failure occurred |
Example Usage:
|
|
7.3 Standard Output Sections
Target
What the user asked about.
Process
Executable, PID, user, command, start time and restart count.
Why It Exists
A causal ancestry chain showing how the process came to exist. This is the core value of witr.
Source
The primary system responsible for starting or supervising the process (best effort).
Examples:
- systemd unit with schedule info for timer-triggered services (Linux)
- launchd service with schedule/trigger details (macOS)
- SSH session (with remote IP and terminal)
- docker container
- pm2
- cron
- interactive shell (detects tmux/screen sessions)
- Snap/Flatpak sandbox (Linux)
Only one primary source is selected.
Context (best effort)
- Working directory
- Git repository name and branch
- Container name / image (docker, podman, kubernetes, colima, containerd)
- Public vs private bind
Warnings
Nonโblocking observations such as:
- Process is running as root
- Dangerous Linux capabilities on non-root processes (CAP_SYS_ADMIN, etc.)
- Process is listening on a public interface (0.0.0.0 / ::)
- Restarted multiple times (warning only if above threshold)
- Process is using high memory (>1GB RSS)
- Process has been running for over 90 days
- Deleted binary, library injection indicators (LD_PRELOAD, DYLD_*)
8. Platform Support
- Linux (x86_64, arm64) - Full feature support (
/proc). - macOS (x86_64, arm64) - Uses
ps,lsof,sysctl,pgrep. - Windows (x86_64, arm64) - Native Win32 APIs (ToolHelp32, PSAPI, Service Control Manager). No PowerShell or WMI dependency.
- FreeBSD (x86_64, arm64) - Uses
procstat,ps,lsof.
8.1 Feature Compatibility Matrix
| Feature | Linux | macOS | Windows | FreeBSD | Notes |
|---|---|---|---|---|---|
| Process Selection | |||||
| By Name | โ | โ | โ | โ | |
| By PID | โ | โ | โ | โ | |
| By Port | โ | โ | โ | โ | |
| By File | โ | โ | โ | โ | |
| By Container | โ | โ | โ | โ | Requires the runtime CLI on PATH (docker/podman/nerdctl/crictl/incus/lxc/lxc-ls/jls). |
| Multiple/mixed inputs | โ | โ | โ | โ | Repeatable flags, mixed types. |
| Exact Match | โ | โ | โ | โ | |
| Full command line | โ | โ | โ | โ | |
| Process start time | โ | โ | โ | โ | |
| Working directory | โ | โ | โ | โ | |
| Environment variables | โ | โ ๏ธ | โ ๏ธ | โ | macOS: SIP restrictions; Windows: protected processes inaccessible. |
| Network | |||||
| Listening ports | โ | โ | โ | โ | |
| Bind addresses | โ | โ | โ | โ | |
| Port โ PID resolution | โ | โ | โ | โ | |
| Port โ Container fallback | โ | โ | โ | โ | Used when the port is owned by PID 1 via systemd socket activation or a container runtime. |
| Service Detection | |||||
| Service Manager | โ | โ | โ | โ | Linux: systemd, macOS: launchd, Windows: Services, FreeBSD: rc.d |
| Service Description | โ | โ | โ | โ | Linux: Description, macOS: Comment, Windows: Display Name, FreeBSD: rc header |
| Configuration Source | โ | โ | โ | โ | Linux: Unit File, macOS: Plist, Windows: Registry Key, FreeBSD: Rc Script |
| Supervisor | โ | โ | โ | โ | |
| Containers | โ | โ | โ | โ | Docker (plus compose mappings), Podman, nerdctl, K8s (Kubepods/crictl), Containerd. Colima on macOS/Linux. Incus/LXC/LXD on Linux. Jails on FreeBSD. |
| SSH session detection | โ | โ | โ | โ | Detects remote IP and terminal. |
| tmux/screen detection | โ | โ | โ | โ | Shows session name in source. |
| Schedule detection | โ | โ | โ | โ | Linux: systemd timers, macOS: launchd intervals/calendar. |
| Snap/Flatpak detection | โ | โ | โ | โ | |
| Health & Diagnostics | |||||
| CPU usage detection | โ | โ | โ | โ | |
| Memory usage detection | โ | โ | โ | โ | |
| Health status detection | โ | โ | โ | โ | |
| Open Files / Handles | โ | โ | โ ๏ธ | โ | Windows: count only. |
| File Locks | โ | โ | โ | โ | Linux: /proc/locks; macOS/FreeBSD: derived from lsof/fstat. |
| Deleted binary detection | โ | โ | โ | โ | Warns if executable is missing. |
| Capability warnings | โ | โ | โ | โ | Warns about dangerous capabilities on non-root processes. |
| Context | |||||
| Git repo/branch detection | โ | โ | โ | โ | |
| Interactive Mode (TUI) | |||||
| Processes Tab | โ | โ | โ | โ | |
| Ports Tab | โ | โ | โ | โ | |
| Containers Tab | โ | โ | โ | โ | |
| Locks Tab | โ | โ | โ | โ | Toggle (a) shows all open files. |
| Process Details | โ | โ | โ | โ | |
| Process Actions | โ | โ | โ | โ |
Legend: โ Full support | โ ๏ธ Partial/limited support | โ Not available
8.2 Permissions Note
Linux/FreeBSD
witr inspects system directories which may require elevated permissions.
If you are not seeing the expected information, try running witr with sudo:
|
|
macOS
On macOS, witr uses ps, lsof, and launchctl to gather process information. Some operations may require elevated permissions:
|
|
Note: Due to macOS System Integrity Protection (SIP), some system process details may not be accessible even with sudo.
Windows
On Windows, witr talks directly to Win32 APIs (ToolHelp32, PSAPI, Service Control Manager) rather than spawning PowerShell or WMI, startup is fast and there’s no Get-CimInstance hang. To see details for processes owned by other users or system services, you must run the terminal as Administrator.
|
|
9. Success Criteria
witr is successful if:
- A user can answer “why is this running?” within seconds
- It reduces reliance on multiple tools
- Output is understandable under stress
- Users trust it during incidents
10. Sponsors
Special thanks to the people who supported witr โค๏ธ