Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to colorize the Gnome terminal in the way the konsole from KDE uses colors? I'd at least like to change the color for user@name:~$, because sometimes it gets pretty hard to read when everything is the same color.

Here are some examples of konsole I would like to emulate for gnome terminal:

enter image description here

enter image description here

share|improve this question

2 Answers 2

up vote 2 down vote accepted

If you're talking about the foreground and background colors of the text within the terminal itself, it is certainly possible. Those colors are produced by ANSI escape codes, which are not specific to either Konsole or gnome-terminal; they work on any terminal program that supports color at all. For a complete list of the codes, see Wikipedia.

To actually use the color codes, you write a sequence of the form \[\033[01;31m\]. That example changes the text foreground color to bright red (01 is bright, 31 is red) until it encounters another color change. To use a different color, change the 31 to any number from 30-37 (for foreground colors) or 40-47 (for background colors). As an example, my shell prompt is set by

export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \W \[\033[01;37m\]\$\[\033[00m\] "

which gives me username@host in green, working directory in blue, and then a literal $ in yellow. The \[\033[00m\] at the end is a reset code which clears whatever foreground/background colors have been set.

By the way, the actual color that, say, 31 corresponds to is normally red, but it can be changed. I know that Konsole allows you to set the ANSI color palette, I'm not sure if gnome-terminal has the same ability.

share|improve this answer
    
Yes, worked for gnome-terminal. –  fazpas Jul 6 '10 at 3:41

See also Gnome Terminal ➤ Edit ➤ Profiles... and vi +/color ~/.bashrc

share|improve this answer
    
Editing bashrc will work, I have to edit PS1= like David Zaslavsky said. –  fazpas Jul 6 '10 at 3:41

Your Answer

 
discard

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.