What is bat?
Bat is a cat (Linux command cat) clone with syntax highlighting and Git integration.
Install bat on Ubuntu and Debian OS:
1 2 3 4 5 6 7 8 |
## Using apt package manager sudo apt install bat mkdir -p ~/.local/bin ln -s /usr/bin/batcat ~/.local/bin/bat ## Using deb package manager sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture |
Install bat on Alpine Linux OS:
1 2 |
## Using apk package manager apk add bat |
Install bat on Arch Linux OS:
1 2 |
## Using pacman pacman -S bat |
Install bat on Fedora OS:
1 2 |
## Using dnf package manager dnf install bat |
Install bat on Funtoo and Gentoo OS:
1 2 |
## Using emerge emerge sys-apps/bat |
Install bat on Void OS:
1 2 |
## using xbps xbps-install -S bat |
Install bat on Termux and FreeBDS OS:
1 2 |
## Using pkg pkg install bat |
Install bat on OpenBDS OS:
1 2 |
## Using pkg pkg_add bat |
Install bat on OpenSUSE OS:
1 2 |
## Using zypper zypper install bat |
Install bat on MAC OS:
1 2 |
## Using homebrew brew install bat |
Install bat on Windows OS:
1 2 |
## Using chocolety choco install bat |
Bat usage example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
## Display a single file on the terminal bat README.md ## Display multiple files at once bat src/*.rs ## With other commands (pipe) curl -s https://sh.rustup.rs | bat ## Read from stdin, specify the language explicitly yaml2json .travis.yml | json_pp | bat -l json ## Show and highlight non-printable characters: bat -A /etc/hosts ## Use as cat replacement (syntax highlight) bat > note.md # quickly create a new file bat header.md content.md footer.md > document.md bat -n main.rs # show line numbers (only) bat f - g # output 'f', then stdin, then 'g' |
To get more details on bat command, please refer https://github.com/sharkdp/bat