Skip to content
Colorized cat command in Python. Uses Pygments to do automatic syntax highlighting.
Branch: dev
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Colorized cat command written in Python. It uses pygments to detect the language and highlight it for the terminal. Supports all pygments lexers and styles. It saves the last style you used for the next run. You can manually specify a lexer if you don't like pygment's 'guess'.

Config is saved as JSON in ccat.json. You can configure your preferences there to be used on each run. It saves you from typing ccat myfile.hs -s monokai -b light every time.


  • docopt - Handles command-line argument parsing.
  • pygments - Syntax highlighting library for Python.


I recommend you symlink this in /usr/bin, ~/.local/bin, or another directory in $PATH:

ln -s /path/to/ /usr/bin/ccat

Here are a couple basic usage examples:

echo "import os" | ccat

To show some debugging info, like which lexer was used:

ccat myfile -D


    ccat -h | -v
    ccat [FILE...] [-b style] [-C] [-D] [-g | -l name] [-n | -N] [-p] [-s name]
    ccat -L | -S

    FILE                         : One or many files to print.
                                   When - is given, or no FILEs are given,
                                   use stdin.
    -b style,--background style  : Either 'light', or 'dark'.
                                   Changes the highlight style.
    -C,--nocolors                : Don't use colors?
    -D,--debug                   : Debug mode. Show more info.
    -g,--guess                   : Guess lexer by file content.
    -h,--help                    : Show this help message.
    -l name,--lexer name         : Use this language/lexer name.
    -L,--lexers                  : List all known lexer names.
    -n,--linenos                 : Print line numbers.
    -N,--nolinenos               : Don't print line numbers.
                                   Overrides config setting.
    -p,--printnames              : Print file names.
    -s name,--style name         : Use this pygments style name.
    -S,--styles                  : List all known style names.
    -v,--version                 : Show version.

P.S.: The most useless use of cat ever:

cat | ccat

And the most useless use of ccat ever:

ccat -C
You can’t perform that action at this time.