PDA

View Full Version : [all variants] [SOLVED] How do I changhe text colour in CLI?



PryGuy
August 19th, 2008, 10:38 AM
Good day! I'm just curious how do I change the text colour in command line (NOT the terminal in Gnome/KDE). Just curious...
Thank you!

Loaded.len
August 19th, 2008, 10:39 AM
you mean like in a tty other than 7?

forger
August 19th, 2008, 11:00 AM
1) Not all commands have coloured output, the .bashrc file in Ubuntu has some commented lines, I uncommented some:

gedit $HOME/.bashrc

The part for the colour, I have it as following:


# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color)
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
;;
esac

# Comment in the above and uncomment this below for a color prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '


edit:
2) You could also use grc: http://gentoo-wiki.com/TIP_Colored_Command_Output_with_grc

PryGuy
August 19th, 2008, 01:10 PM
Thank you! ;)