============================= Setting the BASH shell prompt ============================= -IAN! idallen@idallen.ca Since you now have several Unix machines in your lives (Knoppix, your hard drive, and the new Course Linux Server), you may be uncertain about which machine is receiving your keystrokes. You can change the shell prompt string to include the machine name by changing the contents of environment variable PS1. The BASH shell uses special escape sequences in the prompt string to mean things such as your userid ("\u"), your host name ("\h"), and the last part of the pathname that is your current working directory ("\W"). (See the BASH man page for lots of other goodies.) In the following sequence of commands issued on machine "foobar", you can see the original PS1 contents and the new contents and how each affects the prompt being displayed (note the use of single quotes): bash-2.04$ hostname foobar bash-2.04$ bash-2.04$ echo "$PS1" \s-\v\$ bash-2.04$ PS1='[\u@\h \W]\$ ' [idallen@foobar idallen]$ cd /tmp [idallen@foobar tmp]$ As with the value of any shell variable, this change vanishes when this shell exits. To make this change permanent across logout/login, you must add the line that sets PS1 to one of your login files (e.g. .bash_profile) and also export the PS1 variable to allow other shells to inherit it: In file .bash_profile add these lines: PS1='[\u@\h \W]\$ ' export PS1 The above lines will be executed every time you log in.