Why console prompt behaviour changed when added new color escape sequences to $PS1 in /etc/bashrc?

Solution Verified - Updated -


  • Changed the $PS1 parameter in /etc/bashrc as follows:
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="\\033[1;33mUAT\\033[0m-[\u@\h \W]\\$ "
  • After making above changes the behaviour of console prompt got changed. When up key is pressed to view history, it prints random characters at the prompt.

  • For eg:
    Executed following commands:

   UAT-[root@localhost ~]# yum --nogpgcheck info /home/soft/oracle-validated-1.0.0-24.el5.x86_64.rpm 
   UAT-[root@localhost ~]# ls

Then pressing up key prints weird characters as follows:

UAT-[root@localhost ~]# yum --nops -ef|more


  • Red Hat Enterprise Linux 5.8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content