Set an informative prompt

Sometime when I’m working in UNIX I get lost in the maze of directories, and sometimes I can be working on a few different systems at the same time. So i find it very helpful to set an informative prompt.
The command below, when adding to your .bash_profile or .proifle will make your prompt look something like this:

user@host:/current/directiry>

Add this to you .bash_profile or .proifle file, logout and login again.

PS1='${LOGNAME}@${HOSTNAME}:${PWD}>'; export PS1

You may need to set the HOSTNAME environment variable for the hostname part to work, like this:
HOSTNAME=`hostname`; export HOSTNAME

Leave a Comment

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