该笔记将记录:将终端输出变成彩色的方法
方法一、ANSI escape code - 最古老的方法
使用 ANSI escape code 是最古老的方法:
# echo -e "\033[31;1;4mHello\033[0m" Hello
该命令将输出带下划线的红色 Hello 字符串
方法二、grc
terminal - Output in color - Bash - Unix & Linux Stack Exchange
GitHub - garabik/grc: generic colouriser
# grc tail -f /var/log/syslog
该命令将高亮 syslog 日志输出,通过配置文件可以进行更多控制
其他工具
colortail
GitHub - joakim666/colortail: Like the tail command line utility but with colors
colorex
GitHub - Scopart/colorex: A python script to display log files with colors.
colout
GitHub - nojhan/colout: Color text streams with a polished command line interface
TxtStyle
rainbow
GitHub - nicoulaj/rainbow: Colorize commands output or STDIN using patterns.