This page was last modified: July 27 2006 16:21:06   
Too Cool for Internet Explorer

Changing the prompt

I'm using the shell bash, and when I login the prompt looks like this.:

bash-2.02$

I'm perfectly aware of which shell I'm using, so I don't need that information to follow me around ... instead I want the prompt to show some usefull information, like which account I'm currently using, and the path to the current directory.

Once again www.freebsddiary.org gave the answer: (Please note that this is the solution for the bash shell)

cd /usr/home/bill
vim .profile

Then add the following to the end of the file

# set prompt: ``username@hostname:/directory $ ''
PS1="[\u@\h:\w] "
case `id -u` in
  0) PS1="${PS1}# ";;
  *) PS1="${PS1}$ ";;
esac

If your username is bill and you're logged in at the host flowerpower your prompt would look like this:

[bill@flowerpower:/usr/home/bill]

Note that the change won't take effect before the next login.