Fundamentals 6 min read

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.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Install and Use ccat for Colorized cat Output on Linux

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 ccat

Other Linux distributions (manual)

Download the release archive:

wget https://github.com/jingweno/ccat/releases/download/v1.1.0/linux-amd64-1.1.0.tar.gz

Extract 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/ccat

Basic 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 | ccat

Show the default colour palette: ccat --palette Define custom colours (example):

ccat -G String="_fuchsia_" -G Plaintext="darkteal" hello.c

Replacing 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 ~/.bashrc

Troubleshooting

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):

cat output
cat output
ccat

output (coloured):

ccat output
ccat output
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxInstallationBashcommand-linesyntax highlightingccat
Liangxu Linux
Written by

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.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.