Barbarian Meets Coding

WebDev, UX & a Pinch of Fantasy

1 minute readdevtools

Bat like Cat but Batter

Bat is an in-place replacement for cat that gives you syntax highlighting

Last week I got the uncommon yet welcomed chance to enjoy 30 minutes of parenting-free-ish time when everyone in the house fell asleep exhausted and I didn’t. Wihoo! Me! It just so happened that Suz Hinton was doing a DevTool Time with vanesacodes and TJ DeVries talking about her favorite dev tools and it just sounded like the perfect way to chill: nerding about dev tooling and drinking an alcohol free IPA.

There were a bunch of interesting things in the ~30 or so minutes show (fun show, will definitely look at more episodes) but the one that stuck with me the most, both because I didn’t know about it and because of it simple and brilliant utility was bat.

bat is like cat but with syntax highlighting. Voilà! Never again will I endure a wall of unformatted text in my terminal window. Never. Again.

Using bat on a file shows it with the syntax highlighted

This is such a simple yet powerful upgrade from cat, and it works seamlessly in place. Just do:

alias bat="cat"

And keep walking. It integrates with a bunch of tools that I already use like fzf and git:

fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'

And now I have fzf with colors. Nice!

OK! I’m sold. How do I get it?

Take a look at GitHub for more guidance on how to install it in your OS of choice.

The best part is that you’re using Ubuntu and install bat, the executable will be installed not as bat but batcat. Oh. Yes. Bat. Cat. NaNaNaNaNa BatCat!

BatCat NaNaNaNaNa

Jaime González García

Written by Jaime González García , dad, husband, software engineer, ux designer, amateur pixel artist, tinkerer and master of the arcane arts. You can also find him on Twitter jabbering about random stuff.Jaime González García