Replace Cat With Bat
When using Linux, I often use cat
to browse some short codes. But it doesn't support syntax highlighting originally. So, I found one of its replacements: bat
.
Brief Introduction
On BAT's official GitHub page, it defines itself "a cat clone with wings". In my opinion, one is "syntax highlighting", and the other is "git integration".
Here are some of its important features:
- Syntax highlighting
- Git integration
- Show non-printable characters
- Automatic paging
Installation
In ArchLinux, you can run:
1 | sudo pacman -S bat |
In Termux, you can run:
1 | pkg install bat |
In Ubuntu, you can run:
1 | sudo apt install bat |
Learn more on BAT's GitHub page.
Usage
1 | # Display a single file: |
Learn more on BAT's GitHub page.
Configuration
You can use BAT's configuration file to customize your BAT.
To generate a default config file, run:
1 | bat --generate-config-file |
Here is an example:
1 | # Set the theme |