用 colordiff 给 diff 上色

包装 diff,让新增和删除更醒目。

Linuxdiff 文件对比文本终端低风险
运行 colordiff file1.txt file2.txt,查看彩色差异。

01命令

命令
$ colordiff file1.txt file2.txt

02作用说明

colordiff 把参数转交 diff 并为其输出着色,主题可在 ~/.colordiffrc 配置。想在脚本中使用颜色时,它是用 sed 给 diff 上色的轻量替代。

03风险

风险低风险
使用条件sudo apt install colordiff
!注意: 它只是 diff 包装;需要并排或词级高亮时请用 icdiff 或 delta。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Debian package: colordiff
    Debian · vendor-doc · 2026-09-20
    依据: Debian packages colordiff, a wrapper around diff that colorizes its output.
  • colordiff
    Official project · vendor-doc · 2026-09-20
    依据: Debian packages colordiff, a wrapper around diff that colorizes its output.

最后验证: 2026-09-22 · 分类: 开发者

06相关方案