Console Colour – prompts and tools
Throughout the last week, I have been working on adding colour to the my console. I like colour :).
Colour in a console is achieved through using escape codes. Escape codes are commands that are interpreted by the console, and are used to provide extra features like underlined text, blinking text, and colour.
Some standard UNIX commands provide colour, at least in Arch Linux:
grep --color <expression>
will colourise anything that matches ‘expression’.
My prompt now has colour as well:
Getting colour in the bash prompt was slightly challenging, as I added the script for colourising the prompt in my ‘/etc/profile.d/terminal’ file. In Arch Linux, this is overridden if a /etc/bash.bashrc file exists, as the bashrc file is sourced after ‘/etc/profile.d/*’. I fixed this by adding a patch for my systems, that blanks out the bashrc file.
I am unsure about how good this approach is, but for now it will do.
I’ve also added colour to my console shell scripts: