Replacing Cat with Bat

January 6, 2019

Any frequent user of a Unix operating system will find themselves using the same command line utilities over and over again: rm, mv, ls, cp, grep, and cat to name a handful.

A lot of these utilities are old and are written in C. C is a great language for high performance work but it’s long in the tooth and it’s speed often comes at the cost of reliability and/or security. Of course, whilst classic Unix utilities like cat are battle tested they are often difficult to change. Decades old codebases aren’t the easiest thing to work with and doing so in a way that is backwards compatible and with the same level of assurance of reliability isn’t trivial. Thankfully Rust provides a solution - a language with safety and performance at it’s heart.

Recently I stumbled across a ‘rustified’ version of cat - Bat. Bat is a true cat replacement that also includes syntax highlighting, Git integration, and automatic piping to less - awesome!

Installation was easy and I took the liberty to add an alias so I wouldn’t forget it existed.

sudo dpkg -i bat_0.9.0_amd64.deb
echo "alias cat='bat'" > ~/.bashrc
source ~/.bashrc
Last Updated: 2019-01-07 00:20