Mike Stone

Mostly The Lonely Howls Of Mike Baying His Ideological Purity At The Moon


15 Sep 2020

Most people who spend any quality time a *nix command line are at least passingly familiar with the cat utility. cat is straight forward and simple, and it’s pretty much on every *nix system that exists. Still, if you’re looking to extend it’s capabilities, I highly suggest replacing it with bat.

So, what is bat? bat’s help screen describes it like this:

A cat(1) clone with syntax highlighting and Git integration.

That pretty much sums it up, but there are some extra added things that make it really nice to use.

The defaults of bat add some nice ASCII to the output to really clarify the display which includes line numbers and the file name you’re working with.

Despite the changes to the visual output of the app from how things looked in cat, bat is smart enough to know whether or not it’s output is being funnelled into a pipe and works interchangeably with cat in that scenario. Because of this, you can safely alias bat to cat for your shell.

If the amount of text being displayed on the screen exceeds the screen size, bat automatically integrates with less so you can scroll through the output without having to remember the pipe.

There is actually theme support built into the app that allows you to update the colors. My personal preference is for ansi-dark.

I’ve only tried the syntax highlighting with a handful of different languages, but so far everything I’ve tried has worked out of the gate.

Day 86 of the #100DaysToOffload Series.

Looking for comments? There are no comments. It's not that I don't care what you think, it's just that I don't want to manage a comments section.

If you want to comment, there's a really good chance I at least mentioned this post on Fosstodon, and you can reply to me there. If you don't have a Mastodon account, I'd suggest giving it a try.

If you don't want to join Mastodon, and you still want to comment, feel free to use my contact information.

Also, don't feel obligated, but if you feel like buying me a ☕ cup of coffee ☕ I won't say no.