programmersd21/wlocks
GitHub: programmersd21/wlocks
一款基于 Go 的交互式终端工具,用于实时查看哪些进程打开了哪些文件,是 lsof/fuser 的 TUI 替代方案。
Stars: 10 | Forks: 0
### < wlocks >
*一款终端工具,用于显示哪些进程打开了哪些文件 - 交互式的 `lsof` / `fuser` 替代方案。*
[](https://go.dev)
[](LICENSE)
[](https://github.com/programmersd21/wlocks/releases)
[](https://github.com/programmersd21/wlocks/actions)
[](https://aur.archlinux.org/packages/wlocks-bin)
## 安装
```
# arch linux
yay -S wlocks-bin
# linux (amd64 / arm64)
curl -L https://github.com/programmersd21/wlocks/releases/latest/download/wlocks_linux_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz | tar xz
sudo mv wlocks /usr/local/bin/
# 从 source 构建 (go 1.25+)
git clone https://github.com/programmersd21/wlocks.git && cd wlocks
go build -o wlocks ./cmd/wlocks && sudo mv wlocks /usr/local/bin/
```
## 用法
```
wlocks # current directory
wlocks /path/to/file # specific file or folder
wlocks --theme linear # theme override
wlocks --debug /path # debug diagnostics
```
## 按键
`j`/`k` 导航 · `enter` 详细视图 · `/` 模糊搜索 · `esc` 返回
`K` 终止 · `F` 强制终止 · `P` 暂停/恢复 · `r` 刷新
`s` 排序 · `S` 倒序 · `T` 切换主题 · `ctrl+p` 面板 · `?` 帮助 · `q` 退出
## 功能
- 自动刷新每秒轮询 `/proc`,以获取实时的进程和文件变动
- 详细视图:pid、cmdline、cwd、打开的文件描述符、锁持续时间
- 跨进程名称、命令和文件路径进行模糊搜索
- 按名称、持续时间、pid 或访问模式排序
- 九种主题:`default`、`tokyo`、`catppuccin`、`everforest`、`nord`、`gruvbox`、`apple`、`linear`、`neon`
- 带有确认保护机制的终止 / 暂停 / 强制终止功能
- 配置持久化保存至 `~/.config/wlocks/config.toml`
## 配置
```
theme = "linear"
default_sort = "duration"
live_refresh_rate = 1
animation_speed = "normal"
```
## 工作原理
读取 `/proc/[pid]/fd/*` 符号链接,通过 `filepath.EvalSymlinks` 解析路径以处理 bind mounts 和 namespaces。读写模式来自对 `/proc/[pid]/fdinfo/[fd]` 中 `O_ACCMODE` 位级的解码 - 无需猜测。无法访问的进程将被平滑跳过(在 `--debug` 中可见)。纯 Go 编写,无 cgo,无运行时依赖。
## 许可证
[MIT](LICENSE) © programmersd21
标签:EVTX分析, Go, Ruby工具, TUI, 文件监控, 日志审计, 系统工具