1. Home
  2. Knowledge Base
  3. Unix
  4. Add color to the Unix PS1 prompt

Add color to the Unix PS1 prompt

This has been tested on an AIX box –

To customize the colour of the message on login by updating the profile called on login for a user into a unix machine update the profile with the following –

Red=”33[31m”
RedBG=”33[41m”
LightRed=”33[1;31m”
Green=”33[32m”
GreenBG=”33[42m”
Yellow=”33[33m”
YellowBG=”33[43m”
Blue=”33[34m”
BlueBG=”33[44m”
Purple=”33[35m”
PurpleBG=”33[45m”
BoldON=”33[1m”
BoldOFF=”33[22m”
NC=”33[0m” # No Color
MESSAGE=`echo “$Green$BoldON[DEV]$BoldOFF$NC”`
export MESSAGE
Bold=$(tput smso)
Normal=$(tput sgr0)
export PS1=”$MESSAGE \${ORACLE_SID}:\$PWD > ”

This entry will show a message which points to the machine being a DEV machine and in Green –

Example – The DEV below will show up in colour GREEN –

[DEV] ofsad1:/u01/ofsad1

The following two tabs change content below.

Arjun Raja

Latest posts by Arjun Raja (see all)

Updated on June 2, 2021

Was this article helpful?

Related Articles

Comments

  1. You are not yet in the team – wait till you get selected !!

Leave a Comment