Some versions of
ls need to know from the terminfo database what color codes are supported by the terminal.
First, create the following file (dumb-emacs-ansi.ti):
dumb-emacs-ansi|Emacs dumb terminal with ANSI color codes,
colors#8, it#8, ncv#13, pairs#64,
bold=\E[1m, cud1=^J, ht=^I, ind=^J, op=\E[39;49m,
ritm=\E[23m, rmul=\E[24m, setab=\E[4%p1%dm,
setaf=\E[3%p1%dm, sgr0=\E[m, sitm=\E[3m, smul=\E[4m,
This is a Terminfo entry I created with support for Emacs' own brand of ANSI codes (supports only 8 colors, has bold, italic and underline as independent attributes). Compile it with
Then add to your .bashrc:
if [ "$TERM" = dumb ] && [ "$INSIDE_EMACS" ]; then
export TERM=dumb-emacs-ansi COLORTERM=1
You can just run the export line in your existing shell session to update it without restarting bash.