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?
I don't have comments on this site as they're difficult to manage and take up too much time. I'd rather concentrate on producing content than managing comments.
Instead of leaving a comment, feel free to contact me instead.