Is a Bash shell environment variable
that contains what your prompt
looks like. PS1 is printed each time that Bash asks for a command.
To see what your PS1 looks like, type echo $PS1
To change your PS1, type PS1="new_ps1_value"
People usually do this in their bashrc file.
Within this variable, you may escape certain characters, which will then be interpreted as commands. Here are the examples as according to the bash manpage:
- \h The part of the hostname of the computer you are using before the first .
- \H The full hostmask of the computer you are using
- \n New line
- \u Your username (whoami).
- \w The full path (minus tilde expansion) to the current directory you are in.
- \W The basename of the current directory-- just the name, no path, no trailing /
- \d Current date, "weekday month day format".
- \t The current time, "HH:MM:SS format", 24-hour time
- \T The current time, "HH:MM:SS format", 12-hour time
- \t The current time, "HH:MM:SS format", 12-hour time, with "am" or "pm" appended
- \# "The command number of the current command"
- \! The number of the current command in your .bash_history
- \$ This is a # if you are root and a $ if you are anyone else.
- \a A beep. (In your PROMPT? Wouldn't that kind of suck?)
- \e The ascii escape character.
- \s Basename of your shell (probably Bash?)
- \v The version number of bash you are running
- \V The version number of bash you are running, with the patch number appended.
- \nnn A raw character code, given in octal
- \\ A backslash
- \[ Everything between this character and \] are treated as non-printing characters-- for example, terminal control sequences used to change colors and style and such. (i think? i'll come back later and node something about how to do colors in prompts, once i figure it out. or hardlink it if i find something on e2.)
I personally use "[ \u@\h:\w\$ ] " for my $PS1, but some people choose to get really creative with their prompts, doing complex things with colors and boldness and all that interesting stuff.
See also PS2