So at work I have two web servers that I am able to ssh into.

Both are RHEL 6.5

When I log into one, it shows this:

[username@ldvweb01 /]$ 

When I log into the other one it shows:


I find it way more elegant when it shows the first one. How do I switch between the two? Can someone explain this to me?

After running this echo $PS1 these are the results

-bash-4.1$ echo $PS1


[appadmin@ldvcatweb01 /]$ echo $PS1
[\u@\h \W]\$

After checking for the differences between both home directories. I found that there was no .bashrc or .bash_profile in the home directory.

So I copied the ones from the previous server.

# .bash_profile

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

# User specific environment and startup programs


export PATH


# .bashrc

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

# User specific aliases and functions

I am guess that it just pulls the default bash settings from /etc

Thanks for all your help.


3 Answers 3


The bash prompt is configured by the PS1 environment variable. You can get the prompt you desire by adding

export PS1="[\u@\h \W]\$ "

to your .bashrc file (located in your user's home directory).

The full list of special characters that you can use for your prompt can be found in the official Bash documentation.


Assuming your login shell on both machines is bash, it's the PS1 environment variable that is different. This variable dictates the format of your prompt.

You can use echo $PS1 to see what PS1 is set to on the first machine, then use export PS1=... to set it to the same value on the second machine. To make this change permanent, you should add the export command to your .bashrc file (or possibly your .profile file, which is sourced by login shells - it depends on your configuration.)

Edit: According to your comment, what you need to do to get the exact same prompt on your second machine as on your first machine, is the command

export PS1="[\u@\h \W]\$"

You can make it permanent as already explained.


Your home folder may not be identical on each system. You can check .bashrc or .bash_profile scripts are handle on each server. for the prompt you need to include export PS1="\u@\h \w> " in your bash login script (.bash_profile)

You may want to have your home directory on a NFS mount to be able to see similar environment on each system.

  • This helped me a lot! Those files didn't exist! Thanks! Commented Sep 29, 2014 at 17:55

You must log in to answer this question.

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