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

In the rwx permissions that are listed by ls -l, is it possible to put the first set of rwx in red, the next in blue and the third in green?

For example, is the following possible:

enter image description here

share|improve this question
up vote 3 down vote accepted

Have a look at Arbitrary Command Output Colourer. It can, well, colourize arbitrary command outputs. There is no working DEB archive, but installation trivial (once you have ruby installed). Configuration is via regular expressions and can do whas you want.

share|improve this answer
Super! And in Ruby too! – Zabba Apr 20 '11 at 15:33

Parsing ls output is notoriously error prone, but here's a working version based on find:

while IFS=$'\t' read -r -d '' perms name
    echo "${perms:0:1}$(tput bold; tput setaf 1)${perms:1:3}$(tput setaf 4)${perms:4:3}$(tput setaf 2)${perms:7:3}$(tput sgr0) ${name}"
done < <(find . -maxdepth 1 -printf "%M\t%f\0")
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.