Reading man- and help- pages is boring. Thankfully we can color it with batcat.
cat- alternative
bat is an alternative for displaying file content instead of using cat. bat is capable of recognizing the syntax of multiple languages and displaying it highlightet known from our beloved IDE’s and texteditors. It even brings some Git integration.
To install bat, run the following command in your terminal:
sudo apt install batcat
On Debian and Ubuntu bat uses the command batcat due to a conflict with a different binary. If you haven’t installed that binary, bacula-console-qt you can use bat with the creation of a symlink.
mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat
Another method is to create an alias in your .bashrc. This gives you also the possibility to add some options to the called command. Like if you don’t want the output using the less-style methode.
alias bat='batcat --pager=never'
batcat even brings its own theme set. List it with the following command.
batcat --list-themes
Call the theme by using the flag accordingly in every command.
batcat --theme="TwoDark" /path/to/file.py
Or permanently by adding it to the .bashrc.
export BAT_THEME="TwoDark"
For further usage check out the help-page:
Debian batcat Help-page
Beautiful MANPAGER
With the installed bat command we can color the output of our Help- and Manpages. To do so add the following line to your .bashrc file.
export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
If you want to test various flags and options you can reload your .bashrc file with the following command, so you don’t have to close your terminal session.
source /path/to/.bashrc
Beautiful –help
Of course, you can pipe anything through batcat. So also the --help
output of any command.
vim --help | batcat -l 'man' -p
You can combine this with an easy to remember alias in your .bashrc.
alias manpager='batcat -l man -p'
You can then call it with your alias.
vim --help | manpager