Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I use Emacs and I run bash with M-x term command.

There is a problem: colors in the *terminal* buffer aren't the same as in Gnome Terminal, and they are worse (do you need a screen shot?).

How can I fix this? This is pretty annoying :-) Thank you!

Linux Mint 9

Emacs 23.1.1 x86_64

[.../vagrant]$ echo $TERM

[.../vagrant]$ echo $LS_COLORS
share|improve this question
up vote 1 down vote accepted

The "terminal emulator" implemented by emacs doesn't support as many colors as gnome-terminal does. In fact, it advertises not supporting any colors at all, and here I get ANSI escape sequences not understood by it. What distribution and version are you running that it supports color at all?

See comments below; the answer turns out to be that the OP overrode the terminal type, and recent M-x terminal-emulator supports colors (may actually be the ansi-term mentioned elsewhere in this thread); so fix the colors up using dircolors --print-database >file to dump ls's color database, edit it, then eval $(dircolors file) to load the changed colors into the shell.

share|improve this answer
I edited my answer, thanks! Maybe if I show you my .bashrc you'll help to add a check if the terminal is running in Emacs and change colors? Btw, I'm using not M-x shell, but M-x term, maybe your answer is about the former – valya Mar 7 '11 at 22:56
No, I used M-x terminal-emulator (full name of the command) specifically to make sure I wasn't getting the wrong thing. What does echo $TERM return inside the terminal? How about echo $LS_COLORS? (the latter could potentially be large, although it might also be unset) – geekosaur Mar 7 '11 at 23:05
added these, please take a look! – valya Mar 7 '11 at 23:11
Ok. First thing I notice is you overrode the terminal type (probably in ~/.bashrc; when I do that I also get colors. I notice that all the bold colors are missing, though; while gnome-terminal should support the 16- and 256-color palettes, M-x terminal supports only 8. You're not going to be able to fix this without rewriting or replacing M-x terminal-emulator, I suspect. A possible replacement is <>;. – geekosaur Mar 7 '11 at 23:22
thank you. I tried ansi-term, bad colors again.. maybe I should just try to switch colors (the only one which really irritates me is \033[01;34m\] – valya Mar 7 '11 at 23:29

How about trying a different emacs terminal mode? ansi-term renders colors.

share|improve this answer
the mode renders them but not completely – valya Mar 7 '11 at 23:24

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.