1

I was recently trying to get node.js up and running. One of the steps required that I add an export line to my .bashrc file. Upon doing so, and rebooting the machine, the output of the bash terminal is no longer color-coded.

I have tried copying the default with cp /etc/skel/.bashrc ~/.bashrc and then un-commenting the line force_color_prompt=yes. But when I reboot the machine, the output is still black and white.

If I run source .bashrc or . .bashrc the output works as expected (it's color coded). But this is not the default behavior on login.

How can I set bash to use the color-coded output by default upon login?

migrated from serverfault.com Nov 19 '16 at 8:14

This question came from our site for system and network administrators.

  • What is your PS1? – Ipor Sircer Nov 15 '16 at 17:51
  • You can define color prompt in PS1environment. If you haven't set any color, there will be no colors. – Ipor Sircer Nov 15 '16 at 17:58
  • I haven't messed with PS1 at all. Only with the .bashrc files. SO I don't think that this is the root of the issue. – Native Coder Nov 15 '16 at 17:59
  • just pointing out, that source .bashrc or . .bashrc are the same things – LinuxSecurityFreak Nov 19 '16 at 8:30
1

It may be possible that your .profile does not load the .bashrc file.

cat ~/.profile

Should look somewhat similar to:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

But there are many other places to check:

Are you really running bash:

ls -l $SHELL

If so, be sure to look into all of these, (if they exist):

  1. /etc/profile
  2. ~/.bash_profile
  3. ~/.bash_login
  4. ~/.profile

If the output of ls -l ~/.bashrc contains root as owner/group:

sudo chown $USER:$USER ~/.bashrc

Also, the intended user rights are 644 meaning:

ls -l ~/.bashrc

gives output of:

-rw-r--r--

If not, change it as follows:

chmod 644 ~/.bashrc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.