Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

This question already has an answer here:

Like the title says - is coloring an output possible using cat or similar command?

Let say I have some php or bash script or other. I don't need to edit the file, just to view the source. So cat filename does the job.

But, is it possible to colorize an output making it easier to read, like you can do with vim syntax:on mode?

share|improve this question

marked as duplicate by Mongrel, G-Man, Sato Katsura, GAD3R, Kusalananda 1 hour ago

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Sorry, put the wrong link for duplicate. Here is the real dup. Also see this answer – Ciprian Tomoiaga 6 hours ago
    
That looks like a good reference, but you can't close as a duplicate of a question on another site. – G-Man 4 hours ago
up vote 3 down vote accepted

Yes, grc will achive what you need. github link

enter image description here

share|improve this answer
    
Looking good @steve. Does the script colorize the output of the actual scripts as well? (sorry, haven't tested it yet) – fugitive 12 hours ago

You will need to parse cat's output and colorize it with special utility. You can use grc as it advised here, but you can also use vim for this like it's written here: http://unix.stackexchange.com/a/59207/206456.

share|improve this answer

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