Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using centos in my VPS server and guest system. There're two logins for a guest system. One is root and one is regular. After I mounted the guest system and chroot to the mounting directory, I switched to the regular account in the mounted guest system. Then the brackets missed as shown below:

[root@server image]# chroot /mnt/guest34
[root@server /]# su - regular
-bash-4.1$ sd
-bash: sd: command not found
share|improve this question

migrated from serverfault.com Jun 6 '13 at 19:40

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

up vote 11 down vote accepted

You should read about .bash_profile and .bashrc. The bracketed information is just a preference in those files which typically live in your home directory and/or /etc/profile (look for the line that starts PS1=). I'm assuming that when you're chrooted, that user does not have access to its home folder to load these files, so your prompt is, essentially, un-customized.

Most modern distros will display something like [user@server directory]# but this behavior is controlled by these two files. What you're seeing is bash with no customizations, since they cannot be loaded from the user's home.

share|improve this answer

What's your question?

The appearance of the prompt is defined by the $PS1 variable. Your regular account just doesn't have the brackets in the variable's value.

If you want your regular prompt to look like your root prompt, first log in as root and echo $PS1 and copy or write down the value. Then switch to regular and set that as the value of $PS1. Save it in ~/.bashrc if you want it to stick.

All of this is explained in greater detail in man bash.

share|improve this answer

or, you could just clone this:

git clone git://github.com/christopher-barry/bash-color-tools.git

run ./install from the root of the tree, and have custom theme-able color prompts :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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