cmatrix
是一个模仿电影《黑客帝国》中绿色字符雨效果的终端工具,适合用来炫酷地装饰终端或展示黑客风格效果。以下是它的详细使用技巧和配置方法:
Linux/macOS (通过包管理器):
# Debian/Ubuntu
sudo apt install cmatrix
# RHEL/CentOS/Fedora
sudo yum install cmatrix # 或 sudo dnf install cmatrix
# macOS (Homebrew)
brew install cmatrix
参数 | 效果 |
---|---|
-a |
异步滚动(更流畅) |
-b |
启用粗体字符 |
-B |
所有字符加粗(覆盖-b ) |
-f |
启用终端字体映射 |
-l |
仅显示字母和数字(Linux模式) |
-o |
使用旧式滚动(兼容性模式) |
-x |
窗口模式(字符从底部出现) |
-u <延迟> |
更新速度(单位:毫秒,默认4) |
-C <颜色> |
指定颜色(如 -C green ) |
示例组合:
cmatrix -ab -u 2 -C blue
支持的颜色(通过 -C
参数):
- green
(默认)
- red
、blue
、yellow
、cyan
、white
、black
- 或直接使用十六进制值(如 -C "#FF00FF"
)
空格键
。q
或 Ctrl+C
。+
/-
增减速度。tmux
或终端全屏):
bash
cmatrix -ab -u 1
screen
):
bash
screen -dmS matrix cmatrix -ab
通过修改源码重新编译(默认字符集为ASCII):
1. 下载源码:git clone https://github.com/abishekvashok/cmatrix
2. 修改 chars.h
中的字符数组。
3. 重新编译:
bash
make && sudo make install
.bashrc
或.zshrc
):
bash
if [ "$TERM" = "xterm-256color" ]; then
cmatrix -ab &
fi
-l
(Linux模式)或 -f
(字体映射)。-C green
。-a
启用异步模式,或降低速度(-u 10
)。telnet
或ssh
):
bash
ssh user@example.com -t "cmatrix -ab"
-C red
)作为圣诞主题。掌握这些技巧后,你可以将cmatrix
变成终端中的个性化装饰,或用来吸引同事的注意力!