Thursday, November 13, 2008

CentOS 5 root bash prompt

http://www.pantz.org/software/shell/enhancingshellprompt.html

Default root prompt doesn't show host and current folder, because root doesn't have ~/.bashrc file, that loads /etc/bashrc. To fix it, simply copy .bashrc from other user's home dir or, if you don't need to include /etc/bashrc, create the .bashrc file with
echo 'PS1="[\u@\h \W]\\$ "' > /root/.bashrc
which can also go to %post in kickstart.

To load the change without relogin, run
. ~/.bashrc
(don't miss the dot at the beginning)

1 comment:

Elliot said...

Lovely blog you havve here