Discussion Locked

Changing a Prompt in Unix

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do you chage the prompt of Unix from $ to Current Working directory. ie., the prompt should always show my current working directory as in DOS.

7 replies

by jacob.wilkins

In your /etc/profile, or .bashrc, or .bash_profile (or the cottect config file for your shell)...

Add something like export PS1="\h:\w\$"

This puts your prompt in the format of hostname:workingdir$
If you wish to omit the host name, just dropthe \h:

jrw

by basilisk

It depends on what shell you are using - C Shell, tcsh, Kornshell, Bash, etc. I would look in a book documenting your specific shell (like from O'Reilly); nearly all of them show an example of how to change your prompt to display the working directory.

This discussion is closed to new replies.