1. Home
  2. Knowledge Base
  3. Unix
  4. Customizing the Unix prompt (PS1)

Customizing the Unix prompt (PS1)

We can customize the .profile on Unix to make the prompt display (variable PS1) more meaningful as well as provide some useful shortcuts.

For example, this is the .profile we use on one of the production AIX machines.

This results in the prompt display as shown below where we display the type of the machine using a color combination (in this case Red is used for all Production machines) , the current ORACLE_SID and the present working directory.

[PROD] rcatp:/u01/oracle

stty erase ^?
export ORACLE_SID=rcatp
alias sql=”sqlplus sys/xxx as sysdba”
set -o vi
export EDITOR=/usr/bin/vi
LOGS=/u01/local/bwdba/backup/logs;export LOG
export SCRPT=/u01/local/bwdba/scripts
NC=”33[0m” # No Color
MESSAGE=`echo “$Red$BoldON[PROD]$BoldOFF$NC”`
export MESSAGE
Bold=$(tput smso)
Normal=$(tput sgr0)
export PS1=”$MESSAGE \${ORACLE_SID}:\$PWD > ”

Including aliases and shortcuts make navigation very easy and enables us to quickly locate files when required.

For example to check the alert log we just need to do

$ cd $BDUMP

Or, to check the days RMAN backup logs, we just need to do

$ cd $LOG

The following two tabs change content below.

Gavin Soorma

Latest posts by Gavin Soorma (see all)

Updated on June 2, 2021

Was this article helpful?

Related Articles

Leave a Comment