How to Add Syntax Highlighting to Command Line Output

Posted on
  • install the Python syntax highlighter Pygments
sudo apt-get install python-pygments
  • choose an alias and assign the pygmentize command to it, customizing the style however you’d like
alias catt='pygmentize -O style=monokai -f console256 -g'
  • add the alias line to your bash startup file (.bashrc, for example) to have it available every time you log on
  • enjoy your nicely highlighted command line output!
catt /path/to/file

Leave a Reply

Your email address will not be published. All fields are required.