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

In all the tools to get colors with less command: -R, Pygments, GNU Source-highlight, vless, ... ccze make me sastified with below command:

ccze -A < /path/to/log/file | less -R

but Shift+g doesn't work as expected:

  • I must press Ctrl+c first
  • follow by Shift+g, but it doesn't go to the end of file

Did I miss something?

share|improve this question
up vote 7 down vote accepted

I see similar behavior as you describe when I try this on /var/log/syslog which is 2.1MB in size and around 22500 lines long. Suspecting that ccze was partly to blame for it, I ran:

time ccze -A /var/log/syslog > foo

Which showed that ccze takes around 55 seconds on my 1.2GHz machine to generate the colorized output. I expect this is what makes less hang, less cannot go to the end of the output before ccze has finished generating it, so less seems to hang.

Alternatives to make this work better:

  • Select output with grep, sed etc. and then pipe into ccze.
  • Pre-colorize file and run less on that.
share|improve this answer
Is there any tool to pre-colorize the log file? – quanta Jul 28 '12 at 14:21
I was thinking along the lines of ccze -A LOG > SOME_FILE. Perhaps executed in a cron job. – Thor Jul 28 '12 at 14:26
What do you need it for, does it have to output ANSI sequences? I usually use vim for log viewing, it has good syntax highlighting. Just tested it on a 7 MB log file with no noticable lag. – Thor Jul 28 '12 at 14:52
:se ft=sql doesn't make me happy when viewing /var/log/mysqld.log. – quanta Jul 28 '12 at 15:07
Here is an adapted syntax/messages.vim, pretty simple syn match only. Fetch it here, put it into ~/.vim/syntax and run :set ft=mysqllog. – Thor Jul 28 '12 at 22:47

Both Meta-> and Meta-< work perfectly fine for me. I'm used to them because they do the same in emacs

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.