Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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



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

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

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

share|improve this answer

Your Answer


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.