linux – change shell prompt without affecting the real hostname

echo “export SRVNAME=linux_server” > /etc/profile.d/bash-prompt

#Edit bashrc file to change PS1:
vi /etc/bashrc >>
shopt -s checkwinsize
[ “$PS1” = “\\s-\\v\\\$ ” ] && PS1=”[\u@$SRVNAME \W]\\$ ”

#Change shell title:

vi /etc/sysconfig/bash-prompt >>
echo -ne “\033]0;${USER}@${SRVNAME}:${PWD/#$HOME/~}\007”
chmod +x /etc/sysconfig/bash-prompt

Leave a Reply

Your email address will not be published. Required fields are marked *