PRIMARY CATEGORIES → DESKTOP SETUP • SERVER SETUP
BATCAT → A cat(1) clone with Wings 🦇
This cat
clone offers features such as →
- Syntax Highlighting
It supports it for a large number of Programming and Markup Languages
To list all supported →
bat --list-language
- Git Integration
It displays the modifications compared to the last Commit
- Non-Printable Characters Display
- Pagination
More info here
Installation
First of all, access to the Releases page and copy the Download Link of the bat_X.X.X_amd64.deb
Then, install it as follows →
wget -O bat.deb "DOWNLOAD_LINK_BAT_AMD64.DEB"
sudo dpkg --install bat.deb
That’s it!
$ command -V bat && bat --version
bat is /usr/bin/bat
bat 0.24.0 (fc95468)
CAT → BAT
To replace cat
with bat
, simply add the following aliases in the .zshrc file →
alias cat='bat' # Standard sustitution
alias catn='bat --style=plain' # Only shows Plain Text (No decorations)
alias catnp='bat --style=plain --paging=never' # Plain Text and No Pagination
That’s it!
$ command -V cat
cat is an alias for bat
Integration
BAT supports integrations with other Tools or Functionalities such as →
Find ~ FD
$ sudo find /path/to/dir ... -exec bat {} +
$ fd . /path/to/dir ... --exec-batch bat {}
Command’s Help
- Paginate →
$ nmap --help | bat --plain --language help # Or bat -pl help
- Non-Paginate →
$ nmap --help | bat --plain --language help --paging=never # Or bat -ppl help
Man
$ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
$ man nmap
To make the above action permanent, add the following line in the .zshrc file →
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
Tail -{F,f}
Specially useful for continuos monitoring a file with Syntax Highlighting
$ tail -F /path/to/file.log | bat --paging=never --language log