When using the GNU screen window manager under byobu, the default .bashrc file in Ubuntu (releases 18.04 and 20.04) does not recognize screen as supporting a color prompt. [1]You can find the default .bashrc file in /etc/skel
. At first I thought the lack of color was due to byobu not loading the .bashrc file. But lo and behold, it was related to the case statement which identifies whether your terminal supports color.
The default case statement that checks the value of $TERM
to see whether the terminal supports a color prompt is as follows:
# set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac
Under screen, the value of $TERM
is as follows:
user@computer:~$ echo $TERM screen-256color-bce
As you can see, the conditions xterm-color
and *-256color
in the case statement will not set the color_prompt flag to yes when using screen.
I opted for expanding the *-256color
condition with another asterisk:
# set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in screen*|xterm|xterm-color|*-256color*) color_prompt=yes;; esac
I also included the conditions xterm
and screen*
to allow for a color prompt in Putty.
Footnotes
↑1 | You can find the default .bashrc file in /etc/skel . |
---|