Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Most text editors - vim, emacs, kate, gedit - have colorizers, so that, depending on the language you're programming in, it will color the text differently.

Is there a way to do that for code sent to the STDOUT? So that commands like those will colorize the whole output according to the language of the file (from extension or magic):

cat my-script.py

or

head -n 15 my-script.lua
share|improve this question
add comment

2 Answers 2

Doesn't look like it's been updated in a while, but what about supercat?

share|improve this answer
add comment

pygmentize will output a colorized source code file. It has support for many languages. It determines how to color it based on the file extension or the value you provide with the -l option. To get pygmentize install the python-pygments package.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.