Why is Debian's default bash shell colourless?

Why is the Debian shell (bash) colourless by default?

Because of this (from .bashrc on a vanilla Debian install, emphasis mine):

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
fi

In other words, this is "a feature", or a design choice if you will.


(The original version of the question suggested it was about root’s shell; I’m leaving this here because it might be useful for users wondering specifically about that.)

In root’s case, the default prompt is colourless because /etc/profile — or rather, /etc/bash.bashrc — defines a very simple prompt:

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

and root’s default .bashrc doesn’t override it:

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

See Where do /root/.bashrc and /root/.profile come from on a Debian system? for more details.


Because this was the top result for 'how to colorize root shell in debian' search I am posting my solution here: copy and overwrite /root/.bashrc with the /etc/skel/bashrc file.

This file is much more robust than the installed for root and is also the default used for any new users created on the system.

Below are ls coloring excerpts I've tweaked over the years

alias la='LS_COLORS="mh=1;37" ls -A'
alias l='LS_COLORS="mh=1;37" ls -CF'
alias ll='LC_COLLATE=C LS_COLORS="mh=1;37" ls -lA --si --group-directories-first'

Tags:

Shell

Bash

Debian