Bash prompt without color?

Ask questions about Arch Linux ARM. Please search before making a new topic.

Bash prompt without color?

Postby nidzo » Sat May 22, 2021 6:35 pm

Having a little problem with the freshly installed Arch linux arm on the PC duino3. After the login there is no color used in bash even though I have used the same .bashrc as on other computer (where arch linux is also installed and colors are shown by the bash shell). Now I have managed to look for the information online and by adding a file .bash_login and adding a line
Code: Select all
source ~/.bashrc
The colours are used again. But it would be really awesome to know what is causing this and how to fix it for the whole system and not for just one user. As you can see in the picture I have provided if I log in as a "normal" user there is colour since I have made a .bash_login with "source ~/.bashrc" and once I switch to root there is no colour at all. (root user has also a the same prompt but with the red color, that appears only after I start another LEVEL of BASH!! you can see this in the picture as well.

Here is the link to how it looks like:

The files in /etc/skel look basically the same as with the standard distro.

Code: Select all
# ~/.bashrc
if [ -f ~/bashrc ]; then
        . ~/.bashrc


# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

Code: Select all
# ~/.bash_profile

[[ -f ~/.bashrc ]] && . ~/.bashrc

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc

# User specific environment and startup programs
#export PATH


Code: Select all
# /etc/profile

# Set our umask
umask 022

# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
    case ":$PATH:" in

# Append our default paths
append_path '/usr/local/sbin'
append_path '/usr/local/bin'
append_path '/usr/bin'

# Force PATH to be environment
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
        for profile in /etc/profile.d/*.sh; do
                test -r "$profile" && . "$profile"
        unset profile

# Unload our profile API functions
unset -f append_path

# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\
   test "$PS1" &&\
   test -z "$POSIXLY_CORRECT" &&\
   test "${0#-}" != sh &&\
   test -r /etc/bash.bashrc
        . /etc/bash.bashrc

# Termcap is outdated, old, and crusty, kill it.

# Man is much better than us at figuring this out

I hope you can help me solve this mystery as all other PCs where I have linux installed are recognising colored prompts and showing them properly. (using the same .bashrc as well as .bash_alias files)
Finally this is how the I configure the prompt in .bashrc or .bash_aliases file
Code: Select all
#Bright red prompt with yellow stars and dark red for the folder name
PS1='\[\e[1;31m\][\[\033[40m\]\t \[\e[0;33m\]*** \[\e[1;31m\] \d \[\e[0;33m\]*** \[\e[0;31m\] $PWD]\n\[\e[1;31m\][\u@\H]\$\[\e[0m\]'
Posts: 6
Joined: Wed Dec 24, 2014 3:51 am

Re: Bash prompt without color?

Postby robg » Sun May 23, 2021 2:37 pm

After logging in, your shell is considered an interactive login shell. The first property implies that ~.bashrc is sourced, the second that ~.bash_profile and ~.bash_login are sourced (in that order and with ~.bash_login only taking effect if ~.bash_profile does not exist).

Note that by default, the root user on ALARM does not have a .bashrc file, and the automatically sourced {/etc/bash.bashrc, /etc/profile} contain no color information. Setting this up is left to you. The same, I think, applies to the standard non-root user (alarm).

Long story short: Changing the color scheme of bash is done in .bashrc (per user) and this should be sourced on login and take effect when switching users via `su -`. Can you confirm that said .bashrc files exist in /root and /home/your_user and that your login shell is indeed set to bash?
Posts: 61
Joined: Tue Jan 05, 2021 8:22 am

Return to User Questions

Who is online

Users browsing this forum: No registered users and 6 guests