How to Install and Use ccat for Colorized cat Output on Linux
This guide explains why the standard cat command lacks syntax highlighting, introduces the ccat utility that adds colored output for many programming languages, and provides step‑by‑step installation instructions for Arch and other Linux distributions, along with practical usage examples and troubleshooting tips.
Why ccat?
Traditional cat streams file contents without syntax highlighting, making source code hard to read. ccat is a drop‑in replacement that adds colourised output for many languages (JavaScript, Java, Ruby, Python, Go, C, JSON, etc.).
Installation
Arch Linux (AUR)
Install from the AUR with an AUR helper, e.g.:
yay -S ccatOther Linux distributions (manual)
Download the release archive:
wget https://github.com/jingweno/ccat/releases/download/v1.1.0/linux-amd64-1.1.0.tar.gzExtract the archive: tar xfz linux-amd64-1.1.0.tar.gz Copy the executable to a directory in $PATH (e.g. /usr/local/bin): sudo cp linux-amd64-1.1.0/ccat /usr/local/bin/ Make it executable:
sudo chmod +x /usr/local/bin/ccatBasic usage
Display a single file with colour: ccat hello.c Display multiple files: ccat test.txt example.txt Output HTML instead of terminal colours: ccat test.txt --html Pipe remote files directly:
curl https://raw.githubusercontent.com/jingweno/ccat/master/main.go | ccatShow the default colour palette: ccat --palette Define custom colours (example):
ccat -G String="_fuchsia_" -G Plaintext="darkteal" hello.cReplacing the system cat
Create an alias to use ccat as the default cat command: alias cat=ccat Add the alias to ~/.bashrc (or system‑wide files such as /etc/bashrc or /etc/profile) and reload the shell:
source ~/.bashrcTroubleshooting
If the download fails with an OpenSSL/TLS error, update the local OpenSSL and Git packages to support newer TLS versions.
Visual comparison
Standard cat output (no colours):
ccatoutput (coloured):
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
