witr is a command-line utility designed to provide in-depth insights into why processes, ports, containers, or files are active on a system. It goes beyond the capabilities of traditional tools like `ps`, `top`, and `lsof` by tracing the entire ancestry chain of an item, revealing not just what is running, but the underlying reasons for its execution.
The problem witr addresses is the common frustration of encountering an unknown process, a port conflict, or a lingering container, and having tools that identify the item but not its origin. Understanding the root cause is crucial for effective system administration, debugging, and security, especially when unexpected processes consume resources or create vulnerabilities.
One of witr's core features is its ability to trace the execution chain. By pointing it at a process ID (PID), a port number, a container identifier, or a file, witr reconstructs the sequence of events that led to its existence. This includes identifying the direct initiator, such as `systemd`, `supervisor`, `cron`, or a `shell` session, and tracing back further to understand the complete lineage. This detailed ancestry information is invaluable for pinpointing the exact source of a running process or service.
For interactive use, witr offers a Text User Interface (TUI) when run without arguments. This TUI presents information across multiple tabs, including Processes, Ports, Containers, and Locks. Within these tabs, users can perform live searches and view an ancestry side panel, providing a comprehensive overview of system activity. The TUI is designed for ease of navigation and quick access to critical information.
Beyond its interactive mode, witr is built for scripting and automation. It provides command-line options like `--short` to output a concise, one-line representation of the ancestry chain, ideal for quick checks or logging. For more structured data, the `--json` option outputs results in JSON format, complete with meaningful exit codes that indicate success, error, or the inability to determine the cause, facilitating automated decision-making in scripts.
witr's approach is to provide a clear, traceable explanation for why something is running. It aims to answer the question that standard tools leave unanswered, offering a deeper understanding of system operations. By walking the ancestry chain, it reveals who started a process, when it was initiated, from where, and any relevant warnings or configurations, such as running as root, binding to all interfaces, or exhibiting restart loops.
The benefits of using witr include significantly reduced debugging time, improved system understanding, and enhanced security posture. By quickly identifying the origin of any running process or resource, administrators can more effectively manage their systems, resolve conflicts, and detect potential security threats. The tool's ability to provide context and warnings helps prevent misconfigurations and operational issues.
Specific use cases for witr include diagnosing unexpected CPU usage by a process, understanding which service is occupying a critical network port, identifying the origin of a rogue container, or determining why a specific file is being accessed or locked. It's particularly useful in complex environments with multiple layers of process management, such as those involving containers, service managers, and cron jobs.
witr is distributed as a single, static Go binary, making it easy to deploy across various operating systems including Linux, macOS, Windows, and BSD. It is open-source under the Apache-2.0 license. The tool is designed to be read-only, ensuring its safety for use on production systems without risk of unintended modifications.
In summary, witr is an essential tool for developers and system administrators seeking to understand the 'why' behind their running processes, offering a powerful ancestry tracing capability that complements existing system monitoring utilities.