The cat command is really handy for displaying the contents of a file, but it's not exactly sexy to use. Let's see together how to supercharge its capabilities and turn it into a real productivity ally!
The Bat library will let you push the limits of the cat command by adding line numbers, syntax highlighting, GIT integration that lets you spot changed lines, and a ton of other options (check out the docs on Github, they're very thorough and full of examples).
As for me, I use it with no further configuration and it already makes my life a lot easier.
To install the command bat, nothing could be simpler, all you need is your favorite package manager:
sudo apt install baton Linuxbrew install baton Mac
Personally, I've even replaced the cat command with bat globally using an alias:
"Yeah but, sometimes I use cat to copy my SSH key into my clipboard, that thing of yours puts extra stuff in it"
The developers of bat thought of everything: it automatically detects when its output is being passed as an argument to another command. So if you run the command bat ~/.ssh/id_rsa_github | xcopy , it really is just the file's content that will be copied.
And as a reminder, if you run a command with a \ in front of it, it's the original command that gets executed and not the associated alias. So you can just use \cat myfile.txt for the rare occasions when you'd want to use the original cat command.
It's the kind of library you install once and for all, and only remember exists when you're back on a system where it's missing.






