Usually my terminal prompt was

username place$

now it only shows


and all the color settings have been lost (on the terminal profile I have the same color scheme, but it just don't show colors)

I don't have any idea of what happens (and I don't know how to search for this).

It changes from nothing, I was working with eclipse and maven, opened a new terminal and the new terminal didn't have colors.

Note: I don't have a ~/.bashrc file, but I have a ~/.bash_profile.

  • The prompt is set by the variable PS1, here you can read more about this, there is also various examples of colored prompts
    – RSFalcon7
    Commented Apr 22, 2014 at 13:06
  • Does this happen 1) Only when you log in on a console, 2) Only when you open a new GUI terminal, 3) Both 1 and 2? If you are not sure about #1, switch to a VT and log in, or try bash -l.
    – goldilocks
    Commented Apr 22, 2014 at 13:15
  • @TAFKA'goldilocks' both, if i use bash -l the colours come back, but the promp stills at "bash-4.2$"
    – lcjury
    Commented Apr 22, 2014 at 13:21
  • If my answer doesn't work, post the output from echo $PS1 in the login version w/ the colors.
    – goldilocks
    Commented Apr 22, 2014 at 13:57
  • See also unix.stackexchange.com/q/236005/5132 .
    – JdeBP
    Commented Sep 6, 2020 at 3:39

4 Answers 4


The prompt variable $PS1 was probably not set, so the built-in default \s-\v\$ is used.

When bash starts up interactively, it sources a configuration file, usually either ~/.bashrc or ~/.bash_profile, presuming they exist, and this is how a fancier prompt is set. From man bash:


[...] When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order [...]

[...] When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists.

Not having your prompt set can occur in two different contexts then, login shells and non-login shells. If you use a display manager to log directly into the GUI, you don't encounter login shells unless you switch to a virtual console (via, e.g. CtrlAlt + F1 to F6). However, you can test your bash login profile in the GUI by opening a new login shell explicitly: bash -l.

Problem occurs with non-login shells

If the problem occurs with, e.g., normal GUI terminals, then either your ~/.bashrc is missing, or it has been edited to exclude sourcing a global file, probably /etc/bashrc.

  • If ~/.bashrc does not exist, there should be a /etc/skel/.bashrc used to create it for new users. Simply copy that file into your home directory, and your default prompt should come back for the next new shell you open.

  • If ~/.bashrc does exist, check to see if there is a line somewhere that sources /etc/bashrc:

    . /etc/bashrc
    source /etc/bashrc

    If not, check if that file exists (it should, at least on most linux distros) and add such a line to your ~/.bashrc.

Problem occurs with login shells

If the problem occurs with login shells as well as non-login shells, the problem is probably the same as above. If it occurs only with login shells, you either don't have one of the files mentioned for login shells under the INVOCATION quote above, or they don't source your ~/.bashrc, which is normal on most linux distros. If none of those files exists, create ~/.bash_profile with this in it:

if [ -f ~/.bashrc ]; then
  . ~/.bashrc

This allows you, for the most part, to keep your configuration in one file (~/.bashrc).

If no matter what you do you cannot get a prompt back, you can create one and put it into ~/.bashrc this way:

if [ "$PS1 ]; then
    PS1= .... # see below

This is because $PS1 is set and has a default value for interactive shells, and you don't want to set it otherwise since other things may use this value to determine whether this is an interactive environment.

The bash man page contains a section PROMPTING which describes how to set a prompt with dynamic features such as your user name and current working directory, which would be, e.g.,:

PS1="\u \w:"

There's a guide to using color here. Pay attention to the fact that you should enclose non-printed characters in \[ and \] (there's a discussion of this at the end of the answer about colors).

  • Thanks TAFKA!, most than just an answer I learned something new :)!
    – lcjury
    Commented Apr 22, 2014 at 13:58

Just paste this in ~/.bashrc and ~/.bash_profile as root on effected user.

# Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi


Had to upgrade Cygwin bash for security reasons.

the old bash = 4.1.10(4)-release (i686-pc-cygwin) circa 2009

$ echo $PS1

\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$

the new bash = 4.4.12(3)-release (i686-pc-cygwin) circa 2016

To get the exact same look and feel had to add to .bashrc:


GREEN="\[$(tput setaf 2)\]"

YELLOW="\[$(tput setaf 3)\]"

RESET="\[$(tput sgr0)\]"

PS1="\n${GREEN}\u@\h ${YELLOW}\w${RESET}\n$ "

cd $HOME


note: including the cd $HOME


I experienced the same problem when our DBA was trying to create an oracle user for DB installation. Instead of changing entries, he deleted some profile required files for the user.

I resolved by copying following default files from other user who wasn't facing issue:

  1. /home/username/.bashrc
  2. /home/username/.bashrc_profile
  3. /home/username/.bashrc_logout
  4. /home/username/.bashrc_history

No need to change any settings/text in these files.

Log out the session and login back. You should have your default shell (bash usually) restored with colors and login prompt.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .