docs: make Chinese README the default
PR Check / Security: Vulnerability Scan (push) Has been cancelled
PR Check / Code Quality: Vendor (push) Has been cancelled
PR Check / Tests: Unit (macos-latest) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04-arm) (push) Has been cancelled
PR Check / Code Quality: Coverage (push) Has been cancelled
Update Documentation / update-docs (push) Has been cancelled
PR Check / Code Quality: Format (push) Has been cancelled
PR Check / Code Quality: Lint (darwin) (push) Has been cancelled
PR Check / Code Quality: Lint (freebsd) (push) Has been cancelled
PR Check / Code Quality: Lint (linux) (push) Has been cancelled
PR Check / Code Quality: Lint (windows) (push) Has been cancelled
PR Check / Tests: Unit (windows-latest) (push) Has been cancelled
PR Check / Security: Vulnerability Scan (push) Has been cancelled
PR Check / Code Quality: Vendor (push) Has been cancelled
PR Check / Tests: Unit (macos-latest) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04-arm) (push) Has been cancelled
PR Check / Code Quality: Coverage (push) Has been cancelled
Update Documentation / update-docs (push) Has been cancelled
PR Check / Code Quality: Format (push) Has been cancelled
PR Check / Code Quality: Lint (darwin) (push) Has been cancelled
PR Check / Code Quality: Lint (freebsd) (push) Has been cancelled
PR Check / Code Quality: Lint (linux) (push) Has been cancelled
PR Check / Code Quality: Lint (windows) (push) Has been cancelled
PR Check / Tests: Unit (windows-latest) (push) Has been cancelled
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
<!-- WEHUB_ZH_README -->
|
||||
> [!NOTE]
|
||||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||||
> [English](./README.en.md) · [原始项目](https://github.com/pranshuparmar/witr) · [上游 README](https://github.com/pranshuparmar/witr/blob/HEAD/README.md)
|
||||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||||
|
||||
<div align="center">
|
||||
|
||||
# witr
|
||||
|
||||
### Why is this running?
|
||||
*with* [**Interactive TUI Mode**](#3-interactive-mode-tui) ✨
|
||||
### 为什么它在运行?
|
||||
*搭配* [**交互式 TUI 模式**](#3-interactive-mode-tui) ✨
|
||||
|
||||
[](https://github.com/pranshuparmar/witr/blob/main/go.mod) [](https://www.codefactor.io/repository/github/pranshuparmar/witr) [](https://github.com/pranshuparmar/witr/actions/workflows/release.yml) [](#8-platform-support) <br>
|
||||
[](https://github.com/pranshuparmar/witr/releases/latest) [](https://repology.org/project/witr/versions)
|
||||
|
||||
📖 Read the [story](https://medium.com/@pranshu.parmar/witr-why-is-this-running-a9a97cbedd18) behind witr
|
||||
📖 阅读 witr 背后的 [故事](https://medium.com/@pranshu.parmar/witr-why-is-this-running-a9a97cbedd18)
|
||||
|
||||
<img width="1232" height="693" alt="witr_banner" src="https://github.com/user-attachments/assets/e9c19ef0-1391-4a5f-a015-f4003d3697a9" />
|
||||
|
||||
@@ -18,102 +24,102 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[**Purpose**](#1-purpose) • [**Installation**](#2-installation) • [**TUI**](#3-interactive-mode-tui) • [**Flags**](#4-flags--options) • [**Core Concept**](#5-core-concept) • [**Examples**](#6-example-outputs)
|
||||
[**用途**](#1-purpose) • [**安装**](#2-installation) • [**TUI**](#3-interactive-mode-tui) • [**标志与选项**](#4-flags--options) • [**核心概念**](#5-core-concept) • [**示例**](#6-example-outputs)
|
||||
<br>
|
||||
[**Output Behavior**](#7-output-behavior) • [**Platforms**](#8-platform-support) • [**Success Criteria**](#9-success-criteria) • [**Sponsors**](#10-sponsors)
|
||||
[**输出行为**](#7-output-behavior) • [**平台**](#8-platform-support) • [**成功标准**](#9-success-criteria) • [**赞助商**](#10-sponsors)
|
||||
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## 1. Purpose
|
||||
## 1. 用途
|
||||
|
||||
**witr** exists to answer a single question:
|
||||
**witr** 旨在回答一个简单的问题:
|
||||
|
||||
> **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.
|
||||
当系统上有某个东西在运行时——无论是进程、服务,还是绑定到端口的对象——总有一个原因。这个原因往往并不直接、不易察觉,或分散在多个层面,例如 supervisor、容器、服务或 shell。
|
||||
|
||||
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.
|
||||
现有工具(`ps`, `top`, `lsof`, `ss`, `systemctl`, `docker ps`)会暴露状态与元数据。它们展示的是_正在运行什么_,却让用户不得不在多个工具之间手动比对输出,自行推断_为什么_在运行。
|
||||
|
||||
**witr** makes that causality explicit.
|
||||
**witr** 将这种因果关系明确呈现出来。
|
||||
|
||||
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**.
|
||||
它会在一份易于阅读的单次输出或**交互式 TUI 仪表盘**中,说明**正在运行的对象从何而来**、**如何被启动**,以及**当前是哪些系统链路让它得以存在**。
|
||||
|
||||
---
|
||||
|
||||
## 2. Installation
|
||||
## 2. 安装
|
||||
|
||||
witr is distributed as a single static binary for Linux, macOS, FreeBSD, and Windows.
|
||||
witr 以单个静态二进制形式分发,支持 Linux、macOS、FreeBSD 和 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](https://repology.org/project/witr/versions). Please note that community packages may lag GitHub releases due to independent review and validation.
|
||||
witr 还在多种操作系统与生态系统中独立打包与维护。打包状态的最新概览可在 [Repology](https://repology.org/project/witr/versions). 查看。请注意,由于独立的审查与验证流程,社区软件包可能会滞后于 GitHub 发布版本。
|
||||
|
||||
> [!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.
|
||||
> 如果你使用软件包管理器(Homebrew、Conda、Winget 等),建议通过它们安装,以便更易更新。否则,安装脚本是最快的入门方式。
|
||||
|
||||
---
|
||||
|
||||
### 2.1 Quick Install
|
||||
### 2.1 快速安装
|
||||
|
||||
#### Unix (Linux, macOS & FreeBSD)
|
||||
#### Unix(Linux、macOS 与 FreeBSD)
|
||||
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/pranshuparmar/witr/main/install.sh | bash
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Script Details</summary>
|
||||
<summary>脚本详情</summary>
|
||||
|
||||
The script will:
|
||||
- Detect your operating system (`linux`, `darwin` or `freebsd`)
|
||||
- Detect your CPU architecture (`amd64` or `arm64`)
|
||||
- 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
|
||||
该脚本将:
|
||||
- 检测你的操作系统(`linux`、`darwin` 或 `freebsd`)
|
||||
- 检测你的 CPU 架构(`amd64` 或 `arm64`)
|
||||
- 下载最新发布的二进制文件与 man 页面
|
||||
- 安装到 `/usr/local/bin/witr`
|
||||
- 将 man 页面安装到 `/usr/local/share/man/man1/witr.1`
|
||||
- 传入 INSTALL_PREFIX 以覆盖默认安装路径
|
||||
|
||||
</details>
|
||||
|
||||
#### Windows (PowerShell)
|
||||
#### Windows(PowerShell)
|
||||
|
||||
```powershell
|
||||
irm https://raw.githubusercontent.com/pranshuparmar/witr/main/install.ps1 | iex
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Script Details</summary>
|
||||
<summary>脚本详情</summary>
|
||||
|
||||
The script will:
|
||||
- Download the latest release (zip) and verify checksum.
|
||||
- Extract `witr.exe` to `%LocalAppData%\witr\bin`.
|
||||
- Add the bin directory to your User `PATH`.
|
||||
该脚本将:
|
||||
- 下载最新发布版本(zip)并校验 checksum。
|
||||
- 将 `witr.exe` 解压到 `%LocalAppData%\witr\bin`。
|
||||
- 将 bin 目录添加到你的用户 `PATH`。
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
### 2.2 Package Managers
|
||||
### 2.2 软件包管理器
|
||||
|
||||
<details>
|
||||
<summary><strong>APT (Debian, Ubuntu & Derivatives)</strong> <a href="https://packages.debian.org/sid/witr"><img src="https://repology.org/badge/version-for-repo/debian_unstable/witr.svg?style=flat-square" alt="Debian"></a></summary>
|
||||
<summary><strong>APT(Debian、Ubuntu 及衍生发行版)</strong> <a href="https://packages.debian.org/sid/witr"><img src="https://repology.org/badge/version-for-repo/debian_unstable/witr.svg?style=flat-square" alt="Debian"></a></summary>
|
||||
<br>
|
||||
|
||||
|
||||
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:
|
||||
你可以从官方 Debian 与 Ubuntu 软件源(Ubuntu 26.04+、Debian sid 及更高版本)以及 Kali Linux、Devuan、Raspbian 等衍生发行版安装 **witr**:
|
||||
|
||||
```bash
|
||||
sudo apt install witr
|
||||
```
|
||||
|
||||
> Note: The apt-shipped version may lag the latest GitHub release. For the newest features, use the install script or another installation method.
|
||||
> 注意:通过 apt 分发的版本可能滞后于最新 GitHub 发布版本。如需最新功能,请使用安装脚本或其他安装方式。
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Homebrew (macOS & Linux)</strong> <a href="https://formulae.brew.sh/formula/witr"><img src="https://img.shields.io/homebrew/v/witr?style=flat-square" alt="Homebrew"></a></summary>
|
||||
<summary><strong>Homebrew(macOS 与 Linux)</strong> <a href="https://formulae.brew.sh/formula/witr"><img src="https://img.shields.io/homebrew/v/witr?style=flat-square" alt="Homebrew"></a></summary>
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** using [Homebrew](https://brew.sh/) on macOS or Linux:
|
||||
你可以使用 [Homebrew](https://brew.sh/) 在 macOS 或 Linux 上安装 **witr**:
|
||||
|
||||
```bash
|
||||
brew install witr
|
||||
@@ -121,11 +127,11 @@ brew install witr
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>MacPorts (macOS)</strong> <a href="https://ports.macports.org/port/witr/"><img src="https://repology.org/badge/version-for-repo/macports/witr.svg?style=flat-square" alt="MacPorts"></a></summary>
|
||||
<summary><strong>MacPorts(macOS)</strong> <a href="https://ports.macports.org/port/witr/"><img src="https://repology.org/badge/version-for-repo/macports/witr.svg?style=flat-square" alt="MacPorts"></a></summary>
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** using [MacPorts](https://www.macports.org/) on macOS:
|
||||
你可以使用 [MacPorts](https://www.macports.org/) 在 macOS 上安装 **witr**:
|
||||
|
||||
```bash
|
||||
sudo port install witr
|
||||
@@ -133,11 +139,11 @@ sudo port install witr
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Conda (macOS, Linux & Windows)</strong> <a href="https://anaconda.org/conda-forge/witr"><img src="https://img.shields.io/conda/vn/conda-forge/witr?style=flat-square" alt="Conda"></a></summary>
|
||||
<summary><strong>Conda(macOS、Linux 与 Windows)</strong> <a href="https://anaconda.org/conda-forge/witr"><img src="https://img.shields.io/conda/vn/conda-forge/witr?style=flat-square" alt="Conda"></a></summary>
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** using [conda](https://docs.conda.io/en/latest/), [mamba](https://mamba.readthedocs.io/en/latest/), or [pixi](https://pixi.prefix.dev/latest/) on macOS, Linux, and Windows:
|
||||
你可以使用 [conda](https://docs.conda.io/en/latest/), [mamba](https://mamba.readthedocs.io/en/latest/), 或 [pixi](https://pixi.prefix.dev/latest/) 在 macOS、Linux 和 Windows 上安装 **witr**:
|
||||
|
||||
```bash
|
||||
conda install -c conda-forge witr
|
||||
@@ -149,11 +155,11 @@ pixi global install witr
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Arch Linux (AUR)</strong> <a href="https://aur.archlinux.org/packages/witr-bin"><img src="https://img.shields.io/aur/version/witr-bin?style=flat-square" alt="AUR"></a></summary>
|
||||
<summary><strong>Arch Linux(AUR)</strong> <a href="https://aur.archlinux.org/packages/witr-bin"><img src="https://img.shields.io/aur/version/witr-bin?style=flat-square" alt="AUR"></a></summary>
|
||||
<br>
|
||||
|
||||
|
||||
On Arch Linux and derivatives, install from the [AUR package](https://aur.archlinux.org/packages/witr-bin):
|
||||
在 Arch Linux 及衍生发行版上,可从 [AUR 软件包](https://aur.archlinux.org/packages/witr-bin): 安装:
|
||||
|
||||
```bash
|
||||
yay -S witr-bin
|
||||
@@ -164,11 +170,11 @@ paru -S witr-bin
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Winget (Windows)</strong> <a href="https://winstall.app/apps/PranshuParmar.witr"><img src="https://img.shields.io/winget/v/PranshuParmar.witr?style=flat-square" alt="Winget"></a></summary>
|
||||
<summary><strong>Winget(Windows)</strong> <a href="https://winstall.app/apps/PranshuParmar.witr"><img src="https://img.shields.io/winget/v/PranshuParmar.witr?style=flat-square" alt="Winget"></a></summary>
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** via [winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/):
|
||||
你可以通过 [winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/): 安装 **witr**:
|
||||
|
||||
```powershell
|
||||
winget install -e --id PranshuParmar.witr
|
||||
@@ -176,10 +182,10 @@ winget install -e --id PranshuParmar.witr
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>NPM (Cross-platform)</strong> <a href="https://www.npmjs.com/package/@pranshuparmar/witr"><img src="https://img.shields.io/npm/v/@pranshuparmar/witr?label=npm&color=blue&style=flat-square" alt="NPM"></a></summary>
|
||||
<summary><strong>NPM(跨平台)</strong> <a href="https://www.npmjs.com/package/@pranshuparmar/witr"><img src="https://img.shields.io/npm/v/@pranshuparmar/witr?label=npm&color=blue&style=flat-square" alt="NPM"></a></summary>
|
||||
<br>
|
||||
|
||||
You can install **witr** using [npm](https://www.npmjs.com/package/@pranshuparmar/witr):
|
||||
你可以使用 [npm](https://www.npmjs.com/package/@pranshuparmar/witr): 安装 **witr**:
|
||||
|
||||
```bash
|
||||
npm install -g @pranshuparmar/witr
|
||||
@@ -191,7 +197,7 @@ npm install -g @pranshuparmar/witr
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** on FreeBSD from the [FreshPorts port](https://www.freshports.org/sysutils/witr/):
|
||||
你可以从 [FreshPorts port](https://www.freshports.org/sysutils/witr/): 在 FreeBSD 上安装 **witr**:
|
||||
|
||||
```bash
|
||||
pkg install witr
|
||||
@@ -199,7 +205,7 @@ pkg install witr
|
||||
pkg install sysutils/witr
|
||||
```
|
||||
|
||||
Or build from Ports:
|
||||
或从 Ports 构建:
|
||||
|
||||
```bash
|
||||
cd /usr/ports/sysutils/witr/
|
||||
@@ -208,12 +214,12 @@ make install clean
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Chocolatey (Windows)</strong> <a href="https://community.chocolatey.org/packages/witr"><img src="https://img.shields.io/chocolatey/v/witr?style=flat-square" alt="Chocolatey"></a></summary>
|
||||
<summary><strong>Chocolatey(Windows)</strong> <a href="https://community.chocolatey.org/packages/witr"><img src="https://img.shields.io/chocolatey/v/witr?style=flat-square" alt="Chocolatey"></a></summary>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** using [Chocolatey](https://community.chocolatey.org):
|
||||
你可以使用 [Chocolatey](https://community.chocolatey.org): 安装 **witr**:
|
||||
|
||||
```powershell
|
||||
choco install witr
|
||||
@@ -225,7 +231,7 @@ choco install witr
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** using [Scoop](https://scoop.sh):
|
||||
你可以使用 [Scoop](https://scoop.sh): 安装 **witr**:
|
||||
|
||||
```powershell
|
||||
scoop install main/witr
|
||||
@@ -237,7 +243,7 @@ scoop install main/witr
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** from the [AOSC OS repository](https://packages.aosc.io/packages/witr):
|
||||
你可以从 [AOSC OS 软件仓库](https://packages.aosc.io/packages/witr): 安装 **witr**:
|
||||
|
||||
```bash
|
||||
oma install witr
|
||||
@@ -249,7 +255,7 @@ oma install witr
|
||||
<br>
|
||||
|
||||
|
||||
You can install **witr** from the [GNU Guix repository](https://packages.guix.gnu.org/packages/witr/):
|
||||
你可以从 [GNU Guix 软件仓库](https://packages.guix.gnu.org/packages/witr/): 安装 **witr**:
|
||||
|
||||
```bash
|
||||
guix install witr
|
||||
@@ -260,7 +266,7 @@ guix install witr
|
||||
<summary><strong>Uniget (Linux)</strong> <a href="https://github.com/uniget-org/tools/tree/main/tools/witr"><img src="https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Funiget-org%2Ftools%2Fmain%2Ftools%2Fwitr%2Fmanifest.yaml&query=%24.version&label=uniget&style=flat-square&color=blue" alt="Uniget"></a></summary>
|
||||
<br>
|
||||
|
||||
You can install **witr** using [uniget](https://uniget.dev/):
|
||||
你可以使用 [uniget](https://uniget.dev/): 安装 **witr**:
|
||||
|
||||
```bash
|
||||
uniget install witr
|
||||
@@ -271,7 +277,7 @@ uniget install witr
|
||||
<summary><strong>Aqua (macOS, Linux & Windows)</strong> <a href="https://github.com/aquaproj/aqua-registry/blob/main/pkgs/pranshuparmar/witr"><img src="https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Faquaproj%2Faqua-registry%2Fmain%2Fpkgs%2Fpranshuparmar%2Fwitr%2Fpkg.yaml&query=%24.packages%5B0%5D.name&label=aqua&style=flat-square&color=blue" alt="Aqua"></a></summary>
|
||||
<br>
|
||||
|
||||
You can install **witr** using [aqua](https://aquaproj.github.io/):
|
||||
你可以使用 [aqua](https://aquaproj.github.io/): 安装 **witr**:
|
||||
|
||||
```bash
|
||||
# Add package
|
||||
@@ -286,7 +292,7 @@ aqua i pranshuparmar/witr
|
||||
<summary><strong>Brioche (Linux)</strong> <a href="https://github.com/brioche-dev/brioche-packages/tree/main/packages/witr"><img src="https://img.shields.io/static/v1?label=brioche&message=v0.3.2&color=blue&style=flat-square" alt="Brioche"></a></summary>
|
||||
<br>
|
||||
|
||||
You can install **witr** using [brioche](https://brioche.dev/):
|
||||
你可以使用 [brioche](https://brioche.dev/): 安装 **witr**:
|
||||
|
||||
```bash
|
||||
brioche install -r witr
|
||||
@@ -297,7 +303,7 @@ brioche install -r witr
|
||||
<summary><strong>Mise (macOS, Linux & Windows)</strong> <a href="https://github.com/pranshuparmar/witr/releases/latest"><img src="https://img.shields.io/github/v/release/pranshuparmar/witr?label=mise&style=flat-square" alt="Mise"></a></summary>
|
||||
<br>
|
||||
|
||||
You can install **witr** using [mise](https://mise.jdx.dev/):
|
||||
你可以使用 [mise](https://mise.jdx.dev/): 安装 **witr**:
|
||||
|
||||
```bash
|
||||
mise use github:pranshuparmar/witr
|
||||
@@ -305,12 +311,12 @@ mise use github:pranshuparmar/witr
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Prebuilt Packages (deb, rpm, apk)</strong></summary>
|
||||
<summary><strong>预编译软件包(deb、rpm、apk)</strong></summary>
|
||||
<br>
|
||||
|
||||
**witr** provides native packages for major Linux distributions. You can download the latest `.deb`, `.rpm`, or `.apk` package from the [GitHub releases page](https://github.com/pranshuparmar/witr/releases/latest).
|
||||
**witr** 为主要 Linux 发行版提供原生软件包。你可以从 [GitHub 发布页](https://github.com/pranshuparmar/witr/releases/latest). 下载最新的 `.deb`、`.rpm` 或 `.apk` 软件包。
|
||||
|
||||
- Generic download command using `curl`:
|
||||
- 使用 `curl` 的通用下载命令:
|
||||
```bash
|
||||
# Replace <package name with the actual package that you need>
|
||||
curl -LO https://github.com/pranshuparmar/witr/releases/latest/download/<package-name>
|
||||
@@ -334,26 +340,26 @@ mise use github:pranshuparmar/witr
|
||||
|
||||
---
|
||||
|
||||
### 2.3 Source & Manual Installation
|
||||
### 2.3 源码与手动安装
|
||||
|
||||
<details>
|
||||
<summary><strong>Go (cross-platform)</strong></summary>
|
||||
<summary><strong>Go(跨平台)</strong></summary>
|
||||
<br>
|
||||
|
||||
You can install the latest version directly from source:
|
||||
你可以直接从源码安装最新版本:
|
||||
|
||||
```bash
|
||||
go install github.com/pranshuparmar/witr/cmd/witr@latest
|
||||
```
|
||||
|
||||
This will place the `witr` binary in your `$GOPATH/bin` or `$HOME/go/bin` directory. Make sure this directory is in your `PATH`.
|
||||
这会将 `witr` 二进制文件安装到你的 `$GOPATH/bin` 或 `$HOME/go/bin` 目录中。请确保该目录已加入你的 `PATH`。
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Manual Installation</strong></summary>
|
||||
<summary><strong>手动安装</strong></summary>
|
||||
<br>
|
||||
|
||||
If you prefer manual installation, follow these simple steps for your platform:
|
||||
如果你更倾向于手动安装,请针对你的平台按以下简单步骤操作:
|
||||
|
||||
**Unix (Linux, macOS, FreeBSD)**
|
||||
|
||||
@@ -427,13 +433,13 @@ Remove-Item SHA256SUMS
|
||||
|
||||
---
|
||||
|
||||
### 2.4 Run Without Installation
|
||||
### 2.4 免安装运行
|
||||
|
||||
<details>
|
||||
<summary><strong>Nix Flake</strong></summary>
|
||||
<br>
|
||||
|
||||
If you use Nix, you can build **witr** from source and run without installation:
|
||||
如果你使用 Nix,可以从源码构建 **witr** 并免安装运行:
|
||||
|
||||
```bash
|
||||
nix run github:pranshuparmar/witr -- --help
|
||||
@@ -445,7 +451,7 @@ nix run github:pranshuparmar/witr -- --help
|
||||
<summary><strong>Pixi</strong></summary>
|
||||
<br>
|
||||
|
||||
If you use [pixi](https://pixi.prefix.dev/latest/), you can run without installation on Linux or macOS:
|
||||
如果你使用 [pixi](https://pixi.prefix.dev/latest/),,可以在 Linux 或 macOS 上免安装运行:
|
||||
|
||||
```bash
|
||||
pixi exec witr --help
|
||||
@@ -454,10 +460,10 @@ pixi exec witr --help
|
||||
|
||||
---
|
||||
|
||||
### 2.5 Other Operations
|
||||
### 2.5 其他操作
|
||||
|
||||
<details>
|
||||
<summary><strong>Verify Installation</strong></summary>
|
||||
<summary><strong>验证安装</strong></summary>
|
||||
<br>
|
||||
|
||||
```bash
|
||||
@@ -467,10 +473,10 @@ man witr
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Shell Completions</strong></summary>
|
||||
<summary><strong>Shell 补全</strong></summary>
|
||||
<br>
|
||||
|
||||
`witr` supports tab completion for all flags. To enable it, add the appropriate line to your shell configuration:
|
||||
`witr` 支持所有标志(flag)的 Tab 补全。要启用它,请将相应行添加到你的 shell 配置中:
|
||||
|
||||
**Bash**
|
||||
```bash
|
||||
@@ -499,14 +505,14 @@ witr completion powershell | Out-String | Invoke-Expression
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Uninstallation</strong></summary>
|
||||
<summary><strong>卸载</strong></summary>
|
||||
<br>
|
||||
|
||||
If you installed via a package manager (Homebrew, Conda, etc.), please use the respective uninstall command (e.g., `brew uninstall witr`).
|
||||
如果你是通过包管理器(Homebrew、Conda 等)安装的,请使用对应的卸载命令(例如 `brew uninstall witr`)。
|
||||
|
||||
To completely remove script/manual installation of **witr**:
|
||||
要完全移除 **witr** 的脚本/手动安装:
|
||||
|
||||
**Unix (Linux, macOS, FreeBSD)**
|
||||
**Unix(Linux、macOS、FreeBSD)**
|
||||
|
||||
```bash
|
||||
sudo rm -f /usr/local/bin/witr
|
||||
@@ -522,24 +528,24 @@ Remove-Item -Recurse -Force "$env:LocalAppData\witr"
|
||||
|
||||
---
|
||||
|
||||
## 3. Interactive Mode (TUI)
|
||||
## 3. 交互模式(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.
|
||||
不带任何参数运行 `witr`,或使用 `-i` 标志,将启动 **交互模式(TUI)**。它提供一个实时的、基于终端的仪表盘,包含四个标签页,用于探索进程、端口、容器和文件锁。
|
||||
|
||||
### 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 `a` to 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).
|
||||
### 主要特性:
|
||||
- **进程标签页**:实时、可排序、可筛选的所有运行进程列表,侧边面板显示高亮进程的祖先树。
|
||||
- **端口标签页**:打开/监听中的端口,侧边面板附带所属进程。使用 `a` 在仅 LISTEN 与 ALL 之间切换。
|
||||
- **容器标签页**:在一个列表中汇总 Docker、Podman、nerdctl、K8s/crictl、Incus、LXC、LXD 和 FreeBSD jails 上所有运行中的容器——名称、镜像、状态、端口、命令,以及每个容器的详情视图(挂载、网络和 compose 项目元数据)。
|
||||
- **锁标签页**:系统级文件锁(Linux 上的 POSIX/FLOCK,macOS/FreeBSD 上基于 lsof)。按 `a` 切换到“所有打开文件”模式,其中被锁定的条目会与所有值得关注的打开 fd 合并;在 `/` 中输入以在合并结果中搜索。
|
||||
- **进程详情**:深入查看进程,了解其完整祖先树、子进程、环境变量、工作目录、套接字、文件上下文等。
|
||||
- **进程操作**:直接从 UI 发送信号(Kill、Terminate、Pause、Resume)或 Renice 进程(仅 Unix)。
|
||||
- **鼠标支持**:使用鼠标导航、排序列和点击行。
|
||||
- **自适应主题**:颜色自动适配浅色和深色终端背景。
|
||||
- **自动刷新**:进程、端口、容器和锁列表按自适应节奏自动刷新(起始间隔 3 秒,负载高时退避)。
|
||||
|
||||
---
|
||||
|
||||
## 4. Flags & Options
|
||||
## 4. 标志与选项
|
||||
|
||||
```
|
||||
-c, --container strings container(s) to look up (repeatable)
|
||||
@@ -559,34 +565,34 @@ Running `witr` without any arguments or with the `-i` flag launches the **Intera
|
||||
--warnings show only warnings
|
||||
```
|
||||
|
||||
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.
|
||||
位置参数(不带标志)被视为进程或服务名称。可传入多个名称。默认情况下,名称匹配使用子串匹配(模糊搜索)。使用 `--exact` 仅匹配名称完全一致的进程。
|
||||
|
||||
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.
|
||||
所有目标标志(`--pid`、`--port`、`--file`、`--container`)可重复指定,也可彼此混用,并与位置名称参数混用。提供多个目标时,结果会按顺序显示,并带有带标签的分隔线。所有输出模式(standard、short、tree、JSON、env、warnings、verbose)均支持多个输入。
|
||||
|
||||
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.
|
||||
`--container` 标志会在 Docker、Podman、nerdctl、K8s/crictl、Incus、LXC、LXD 和 FreeBSD jails 中搜索,并匹配容器名称、镜像、命令以及 compose 项目/服务标签。
|
||||
|
||||
The TUI is launched if no arguments or relevant flags (`--pid`, `--port`, `--file`, `--container`) are provided, or if the `--interactive` flag is explicitly used.
|
||||
若未提供任何参数或相关标志(`--pid`、`--port`、`--file`、`--container`),或显式使用 `--interactive` 标志,则会启动 TUI。
|
||||
|
||||
---
|
||||
|
||||
## 5. Core Concept
|
||||
## 5. 核心概念
|
||||
|
||||
witr treats **everything as a process question**.
|
||||
witr 将 **一切视为进程问题**。
|
||||
|
||||
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_.
|
||||
端口、服务、容器和命令最终都会映射到 **PID**。一旦确定 PID,witr 会构建一条因果链,解释 _该 PID 为何存在_。
|
||||
|
||||
At its core, witr answers:
|
||||
其核心回答以下问题:
|
||||
|
||||
1. What is running?
|
||||
2. How did it start?
|
||||
3. What is keeping it running?
|
||||
4. What context does it belong to?
|
||||
1. 正在运行什么?
|
||||
2. 它是如何启动的?
|
||||
3. 是什么让它保持运行?
|
||||
4. 它属于什么上下文?
|
||||
|
||||
---
|
||||
|
||||
## 6. Example Outputs
|
||||
## 6. 示例输出
|
||||
|
||||
### 6.1 Name Based Query
|
||||
### 6.1 基于名称的查询
|
||||
|
||||
```bash
|
||||
witr node
|
||||
@@ -612,7 +618,7 @@ Sockets : 127.0.0.1:5001 (TCP | LISTENING)
|
||||
|
||||
---
|
||||
|
||||
### 6.2 Short Output
|
||||
### 6.2 简短输出
|
||||
|
||||
```bash
|
||||
witr --port 5000 --short
|
||||
@@ -624,7 +630,7 @@ systemd (pid 1) → PM2 v5.3.1: God (pid 1481580) → python (pid 1482060)
|
||||
|
||||
---
|
||||
|
||||
### 6.3 Tree Output
|
||||
### 6.3 树形输出
|
||||
|
||||
```bash
|
||||
witr --pid 143895 --tree
|
||||
@@ -643,11 +649,11 @@ systemd (pid 1)
|
||||
└─ node (pid 144234)
|
||||
```
|
||||
|
||||
Note: _Tree view includes child processes (up to 10) and highlights the target process._
|
||||
注意:_树形视图包含子进程(最多 10 个)并高亮目标进程。_
|
||||
|
||||
---
|
||||
|
||||
### 6.4 Multiple Matches
|
||||
### 6.4 多个匹配
|
||||
|
||||
```bash
|
||||
witr ng
|
||||
@@ -667,7 +673,7 @@ Re-run with:
|
||||
witr --pid <pid>
|
||||
```
|
||||
|
||||
To avoid substring matching and only find processes with an exact name, use the `--exact` flag:
|
||||
要避免子串匹配、仅查找名称完全一致的进程,请使用 `--exact` 标志:
|
||||
|
||||
```bash
|
||||
witr nginx -x
|
||||
@@ -675,27 +681,27 @@ witr nginx -x
|
||||
|
||||
---
|
||||
|
||||
### 6.5 File Based Query
|
||||
### 6.5 基于文件的查询
|
||||
|
||||
```bash
|
||||
witr --file /var/lib/dpkg/lock
|
||||
```
|
||||
|
||||
Explains the process holding a file open.
|
||||
解释哪个进程正在占用该文件。
|
||||
|
||||
---
|
||||
|
||||
### 6.6 Container Based Query
|
||||
### 6.6 基于容器的查询
|
||||
|
||||
```bash
|
||||
witr --container redis
|
||||
```
|
||||
|
||||
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.
|
||||
在每个检测到的运行时(Docker、Podman、nerdctl、K8s/crictl、Incus、LXC、LXD、FreeBSD jails)中,按名称、镜像、命令或 compose 项目/服务查找容器。传入 `--verbose` 可在输出中包含挂载、网络和 compose 元数据。
|
||||
|
||||
---
|
||||
|
||||
### 6.7 Multiple Inputs
|
||||
### 6.7 多个输入
|
||||
|
||||
```bash
|
||||
witr nginx --port 5432 --pid 1234
|
||||
@@ -718,35 +724,35 @@ Process : node (pid 1234)
|
||||
...
|
||||
```
|
||||
|
||||
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.
|
||||
所有目标标志均可重复指定并混用。结果按你输入的顺序显示。所有输出模式(`--short`、`--tree`、`--json`、`--env`、`--warnings`、`--verbose`)均支持多个输入。
|
||||
|
||||
---
|
||||
|
||||
## 7. Output Behavior
|
||||
## 7. 输出行为
|
||||
|
||||
### 7.1 Output Principles
|
||||
### 7.1 输出原则
|
||||
|
||||
- Single screen by default (best effort)
|
||||
- Deterministic ordering
|
||||
- Narrative-style explanation
|
||||
- Best-effort detection with explicit uncertainty
|
||||
- 默认单屏显示(尽力而为)
|
||||
- 确定性排序
|
||||
- 叙述式说明
|
||||
- 尽力检测,并明确标示不确定性
|
||||
|
||||
---
|
||||
|
||||
### 7.2 Exit Codes
|
||||
### 7.2 退出码
|
||||
|
||||
witr returns meaningful exit codes for use in scripts, CI pipelines, and monitoring:
|
||||
witr 返回有意义的退出码,供脚本、CI 流水线和监控使用:
|
||||
|
||||
| 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 |
|
||||
| 0 | Clean:找到进程,无警告 |
|
||||
| 1 | Warnings:找到进程,但有一个或多个警告 |
|
||||
| 2 | Not found:未找到匹配的进程或服务 |
|
||||
| 3 | Permission denied:权限不足 |
|
||||
| 4 | Invalid input:参数无效或匹配歧义 |
|
||||
| 5 | Internal error:发生意外故障 |
|
||||
|
||||
#### Example Usage:
|
||||
#### 示例用法:
|
||||
|
||||
```bash
|
||||
witr nginx --short
|
||||
@@ -762,128 +768,128 @@ esac
|
||||
|
||||
---
|
||||
|
||||
### 7.3 Standard Output Sections
|
||||
### 7.3 标准输出章节
|
||||
|
||||
#### Target
|
||||
|
||||
What the user asked about.
|
||||
用户查询的对象。
|
||||
|
||||
#### Process
|
||||
|
||||
Executable, PID, user, command, start time and restart count.
|
||||
可执行文件、PID、用户、命令、启动时间和重启次数。
|
||||
|
||||
#### Why It Exists
|
||||
|
||||
A causal ancestry chain showing how the process came to exist.
|
||||
This is the core value of witr.
|
||||
展示进程如何产生的因果祖先链。
|
||||
这是 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
|
||||
- systemd 单元(含定时器触发服务的调度信息)(Linux)
|
||||
- launchd 服务(含调度/触发详情)(macOS)
|
||||
- SSH 会话(含远程 IP 与终端)
|
||||
- docker 容器
|
||||
- pm2
|
||||
- cron
|
||||
- interactive shell (detects tmux/screen sessions)
|
||||
- Snap/Flatpak sandbox (Linux)
|
||||
- 交互式 shell(可检测 tmux/screen 会话)
|
||||
- Snap/Flatpak 沙箱(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
|
||||
- 工作目录
|
||||
- Git 仓库名称与分支
|
||||
- 容器名称/镜像(docker、podman、kubernetes、colima、containerd)
|
||||
- 公共绑定与私有绑定
|
||||
|
||||
#### 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_*)
|
||||
- 进程以 root 运行
|
||||
- 非 root 进程具有危险的 Linux capabilities(CAP_SYS_ADMIN 等)
|
||||
- 进程正在公共接口上监听(0.0.0.0 / ::)
|
||||
- 多次重启(仅当超过阈值时警告)
|
||||
- 进程占用大量内存(>1GB RSS)
|
||||
- 进程已运行超过 90 天
|
||||
- 已删除的二进制文件、库注入指标(LD_PRELOAD、DYLD_*)
|
||||
|
||||
---
|
||||
|
||||
## 8. Platform Support
|
||||
## 8. 平台支持
|
||||
|
||||
- **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`.
|
||||
- **Linux**(x86_64、arm64)— 完整功能支持(`/proc`)。
|
||||
- **macOS**(x86_64、arm64)— 使用 `ps`、`lsof`、`sysctl`、`pgrep`。
|
||||
- **Windows**(x86_64、arm64)— 原生 Win32 API(ToolHelp32、PSAPI、Service Control Manager)。不依赖 PowerShell 或 WMI。
|
||||
- **FreeBSD**(x86_64、arm64)— 使用 `procstat`、`ps`、`lsof`。
|
||||
|
||||
---
|
||||
|
||||
### 8.1 Feature Compatibility Matrix
|
||||
### 8.1 功能兼容性矩阵
|
||||
|
||||
| Feature | Linux | macOS | Windows | FreeBSD | Notes |
|
||||
| 功能 | Linux | macOS | Windows | FreeBSD | 说明 |
|
||||
|---------|:-----:|:-----:|:-------:|:-------:|-------|
|
||||
| **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 | ✅ | ✅ | ❌ | ✅ | |
|
||||
| **进程选择** |
|
||||
| 按名称 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 按 PID | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 按端口 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 按文件 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 按容器 | ✅ | ✅ | ✅ | ✅ | 需要运行时 CLI 在 PATH 中(docker/podman/nerdctl/crictl/incus/lxc/lxc-ls/jls)。 |
|
||||
| 多个/混合输入 | ✅ | ✅ | ✅ | ✅ | 可重复的标志、混合类型。 |
|
||||
| 精确匹配 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 完整命令行 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 进程启动时间 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 工作目录 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 环境变量 | ✅ | ⚠️ | ⚠️ | ✅ | macOS:SIP 限制;Windows:受保护进程不可访问。 |
|
||||
| **网络** |
|
||||
| 监听端口 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 绑定地址 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 端口 → PID 解析 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 端口 → 容器回退 | ✅ | ✅ | ✅ | ✅ | 当端口由 PID 1 通过 systemd socket activation 或容器运行时占用时使用。 |
|
||||
| **服务检测** |
|
||||
| 服务管理器 | ✅ | ✅ | ✅ | ✅ | Linux:systemd,macOS:launchd,Windows:Services,FreeBSD:rc.d |
|
||||
| 服务描述 | ✅ | ✅ | ✅ | ✅ | Linux:`Description`,macOS:`Comment`,Windows:`Display Name`,FreeBSD:`rc` 标头 |
|
||||
| 配置来源 | ✅ | ✅ | ✅ | ✅ | Linux:Unit File,macOS:Plist,Windows:Registry Key,FreeBSD:Rc Script |
|
||||
| 监管器 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 容器 | ✅ | ✅ | ✅ | ✅ | Docker(含 compose 映射)、Podman、nerdctl、K8s(Kubepods/crictl)、Containerd。macOS/Linux 上的 Colima。Linux 上的 Incus/LXC/LXD。FreeBSD 上的 Jails。 |
|
||||
| SSH 会话检测 | ✅ | ✅ | ✅ | ✅ | 检测远程 IP 与终端。 |
|
||||
| tmux/screen 检测 | ✅ | ✅ | ❌ | ✅ | 在来源中显示会话名称。 |
|
||||
| 调度检测 | ✅ | ✅ | ❌ | ❌ | Linux:systemd timers,macOS:launchd intervals/calendar。 |
|
||||
| Snap/Flatpak 检测 | ✅ | ❌ | ❌ | ❌ | |
|
||||
| **健康状态与诊断** |
|
||||
| CPU 使用率检测 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 内存使用率检测 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 健康状态检测 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 打开的文件/句柄 | ✅ | ✅ | ⚠️ | ✅ | Windows:仅计数。 |
|
||||
| 文件锁 | ✅ | ✅ | ❌ | ✅ | Linux:`/proc/locks`;macOS/FreeBSD:源自 `lsof`/`fstat`。 |
|
||||
| 已删除二进制文件检测 | ✅ | ✅ | ✅ | ✅ | 若可执行文件缺失则发出警告。 |
|
||||
| Capability 警告 | ✅ | ❌ | ❌ | ❌ | 对非 root 进程的危险 capabilities 发出警告。 |
|
||||
| **上下文** |
|
||||
| Git 仓库/分支检测 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| **交互模式(TUI)** |
|
||||
| 进程标签页 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 端口标签页 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 容器标签页 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 锁标签页 | ✅ | ✅ | ❌ | ✅ | 切换(`a`)显示所有打开的文件。 |
|
||||
| 进程详情 | ✅ | ✅ | ✅ | ✅ | |
|
||||
| 进程操作 | ✅ | ✅ | ❌ | ✅ | |
|
||||
|
||||
**Legend:** ✅ Full support | ⚠️ Partial/limited support | ❌ Not available
|
||||
**图例:** ✅ 完整支持 | ⚠️ 部分/有限支持 | ❌ 不可用
|
||||
|
||||
---
|
||||
|
||||
### 8.2 Permissions Note
|
||||
### 8.2 权限说明
|
||||
|
||||
#### Linux/FreeBSD
|
||||
|
||||
witr inspects system directories which may require elevated permissions.
|
||||
witr 会检查系统目录,这可能需要提升权限。
|
||||
|
||||
If you are not seeing the expected information, try running witr with sudo:
|
||||
若未看到预期信息,请尝试使用 sudo 运行 witr:
|
||||
|
||||
```bash
|
||||
sudo witr [your arguments]
|
||||
@@ -891,17 +897,17 @@ sudo witr [your arguments]
|
||||
|
||||
#### macOS
|
||||
|
||||
On macOS, witr uses `ps`, `lsof`, and `launchctl` to gather process information. Some operations may require elevated permissions:
|
||||
在 macOS 上,witr 使用 `ps`、`lsof` 和 `launchctl` 收集进程信息。某些操作可能需要提升权限:
|
||||
|
||||
```bash
|
||||
sudo witr [your arguments]
|
||||
```
|
||||
|
||||
Note: Due to macOS System Integrity Protection (SIP), some system process details may not be accessible even with sudo.
|
||||
注意:由于 macOS 系统完整性保护(System Integrity Protection,SIP),即使用 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**.
|
||||
在 Windows 上,witr 直接调用 Win32 API(ToolHelp32、PSAPI、Service Control Manager),而非启动 PowerShell 或 WMI,启动迅速且不会出现 `Get-CimInstance` 卡顿。要查看其他用户或系统服务所拥有的进程详情,必须以 **Administrator** 身份运行终端。
|
||||
|
||||
```powershell
|
||||
# Run in Administrator PowerShell
|
||||
@@ -910,20 +916,20 @@ On Windows, witr talks directly to Win32 APIs (ToolHelp32, PSAPI, Service Contro
|
||||
|
||||
---
|
||||
|
||||
## 9. Success Criteria
|
||||
## 9. 成功标准
|
||||
|
||||
witr is successful if:
|
||||
witr 在以下情况下算是成功:
|
||||
|
||||
- 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
|
||||
## 10. 赞助商
|
||||
|
||||
Special thanks to the people supporting **witr** ❤️
|
||||
特别感谢支持 **witr** 的朋友们 ❤️
|
||||
|
||||
<p>
|
||||
<a href="https://github.com/timcolson" title="Tim Colson">
|
||||
|
||||
Reference in New Issue
Block a user