Archive

How Do I Change BASH# Prompt to Show My Current Directory?

It is really very simple.  There are many different ways to customize your BASH PS1(prompt).

 In your home directory, edit the .bash_profile text file and add:

export PS1="\w :"

If you use "\W" you will get only the top-level directory that you are working in.

There are several other shell escape characters that come in handy for UNIX SHELL scripting as well.  .....

Some others are:

\a   - The ASCII bell Character (007)

\d   - The date in "Weekday Month Day" format

\e   - The ASCII escape character (033)

\H   - fully qualified Hostname.abc.com

\h   - The hostname

\n   - A carriage return

\s   -  The name of the Shell

\T   - The current time in 12-hour HH:MM:SS format

\t    - The current time in 24-hour format

\@   - The current time in a 12-hour am/pm format