How To Install bat on Ubuntu 20.04
Introduction
In this tutorial we learn how to install bat on Ubuntu 20.04.
What is bat
bat is:
bat is a drop-in cat(1) replacement featuring:
- syntax highlighting for a large number of languages;
- git integration;
- automatic paging;
- a user-friendly command-line interface.
In this package the executable and its manpage have been renamed from ‘bat’ to ‘batbat’ because of a file name clash with another Debian paclage.
This package contains the following binaries built from the Rust crate “bat”:
- bat X-Cargo-Built-Using: rust-adler32 (= 1.0.3-1), rust-aho-corasick (= 0.7.8-1), rust-ansi-colours (= 1.0.1-2), rust-ansi-term (= 0.12.1-1), rust-atty (= 0.2.13-2), rust-base64 (= 0.11.0-1), rust-bincode (= 1.2.1-2), rust-bitflags (= 1.2.1-1), rust-byteorder (= 1.3.2-2), rust-cfg-if (= 0.1.10-2build1), rust-clap (= 2.33.0-5), rust-clicolors-control (= 1.0.1-1), rust-console (= 0.8.0-1), rust-content-inspector (= 0.2.4-1), rust-crc32fast (= 1.2.0-1), rust-dirs (= 2.0.2-1), rust-dirs-sys (= 0.3.4-1), rust-encoding (= 0.2.33-1), rust-encoding-index-japanese (= 1.20141219.5-1), rust-encoding-index-korean (= 1.20141219.5-1), rust-encoding-index-simpchinese (= 1.20141219.5-1), rust-encoding-index-singlebyte (= 1.20141219.5-1), rust-encoding-index-tests (= 0.1.4-1), rust-encoding-index-tradchinese (= 1.20141219.5-1), rust-error-chain (= 0.12.0-1build1), rust-flate2 (= 1.0.13-1), rust-fnv (= 1.0.6-1), rust-git2 (= 0.10.2-1), rust-humantime (= 1.3.0-1), rust-idna (= 0.2.0-1), rust-indexmap (= 1.2.0-1), rust-itoa (= 0.4.3-1), rust-lazy-static (= 1.4.0-1), rust-lazycell (= 1.2.1-1), rust-libc (= 0.2.66-1), rust-libgit2-sys (= 0.9.2-2), rust-libz-sys (= 1.0.25-1), rust-line-wrap (= 0.1.1-1), rust-linked-hash-map (= 0.5.2-2), rust-log (= 0.4.8-4), rust-matches (= 0.1.8-1), rust-memchr (= 2.2.1-1), rust-miniz-oxide (= 0.3.5-1), rust-onig (= 5.0.0-2), rust-onig-sys (= 69.2.0-1), rust-percent-encoding (= 2.1.0-2), rust-plist (= 0.5.1-1), rust-quick-error (= 1.2.2-1), rust-regex (= 1.2.1-3), rust-regex-syntax (= 0.6.13-1), rust-ryu (= 1.0.2-1), rust-safemem (= 0.3.3-1), rust-same-file (= 1.0.6-1), rust-serde (= 1.0.104-1), rust-serde-json (= 1.0.41-1), rust-shell-words (= 0.1.0-1), rust-smallvec (= 1.1.0-1), rust-strsim (= 0.9.3-1), rust-syntect (= 3.3.0-2), rust-term-size (= 0.3.1-2), rust-termios (= 0.3.0-1), rust-textwrap (= 0.11.0-1build1), rust-thread-local (= 0.3.6-1), rust-unicode-bidi (= 0.3.4-2), rust-unicode-normalization (= 0.1.11-1), rust-unicode-width (= 0.1.7-1), rust-url (= 2.1.0-1), rust-vec-map (= 0.8.1-2), rust-walkdir (= 2.3.1-1), rust-wild (= 2.0.2-1), rust-xml-rs (= 0.8.0-1), rust-yaml-rust (= 0.4.3-1), rustc (= 1.41.0+dfsg1+llvm-0ubuntu1)
There are three methods to install bat on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.
Install bat Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get update
After updating apt database, We can install bat using apt-get by running the following command:
sudo apt-get -y install bat
Install bat Using apt
Update apt database with apt using the following command.
sudo apt update
After updating apt database, We can install bat using apt by running the following command:
sudo apt -y install bat
Install bat Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.
sudo aptitude update
After updating apt database, We can install bat using aptitude by running the following command:
sudo aptitude -y install bat
How To Uninstall bat on Ubuntu 20.04
To uninstall only the bat package we can use the following command:
sudo apt-get remove bat
Uninstall bat And Its Dependencies
To uninstall bat and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:
sudo apt-get -y autoremove bat
Remove bat Configurations and Data
To remove bat configuration and data from Ubuntu 20.04 we can use the following command:
sudo apt-get -y purge bat
Remove bat configuration, data, and all of its dependencies
We can use the following command to remove bat configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge bat
References
Summary
In this tutorial we learn how to install bat package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.