最近,GitHub Trending 榜单上出现了一个新面孔——bashtop。这是一个用纯 Bash 编写的 Linux 资源监视器,连续霸榜近一周。相比传统的 top 或 htop,它提供了更现代化的交互体验,同时保持了极低的资源占用。
bashtop 的核心优势在于其响应迅速且易于操作的 UI。它采用了类似游戏菜单的设计,通过上下键即可快速定位进程。除了基础的 CPU、内存、磁盘和网络监控外,它还支持对选定进程发送 SIGTERM、SIGKILL 等信号,甚至能自动缩放网络使用图表。如果检测到新版本,菜单里也会直接提示。
配置管理同样直观。所有选项都可以通过界面内的菜单修改,配置文件默认保存在 $HOME/.config/bashtop/bashtop.cfg。以下是配置文件的典型结构,主要涉及颜色主题、刷新频率、进程排序方式以及温度检测开关等:
#? Config file for bashtop v. 0.8.0
#* Color theme, looks for a .theme file in "$HOME/.config/bashtop/themes", "Default" for builtin default theme
color_theme="Default"
#* Update time in milliseconds, increases automatically if set below internal loops processing time, recommended 2000 ms or above for better sample times for graphs
update_ms="2500"
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu responsive"
#* "cpu lazy" upates sorting over time, "cpu responsive" updates sorting directly at a cpu usage cost
proc_sorting="cpu lazy"
#* Reverse sorting order, "true" or "false"
proc_reversed="false"
#* Check cpu temperature, only works if "sensors" command is available and have values for "Package" and "Core"
check_temp="true"
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable
draw_clock="%R"
#* Update main ui when menus are showing, set this to false if the menus is flickering too much for comfort
background_update="true"
#* Custom cpu model name, empty string to disable
custom_cpu_name=""
#* Enable error logging to "$HOME/.config/bashtop/error.log", "true" or "false"
error_logging="true"
命令行参数目前尚未完全实现,主要依赖交互式菜单进行操作。如果你正在寻找一个轻量级且功能强大的系统监控工具,bashtop 值得尝试。项目地址如下:


