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

PS1 is not specific to bash. It is a standard environment variable meaning something like "prompt level 1". The syntax is even different for different shells. For example, in zsh, my PS1 looks like: "%n@%U%m%u:%~ %{^[[1m^[[31m%}%#%{^[[00m%}" which puts me in the "creative group" as I have a bright red end-of-prompt thingie.


PS1 is also an art museum located at 22-25 Jackson Ave at the intersection of 46th Ave in Long Island City, In Queens, NY. The museum features a large fixed collection, including some mind blowing installations and rotating exhibits. The museum is named PS1 because the site was originally a New York City Public School.

During the summer months, on Saturdays, they get some pretty respected DJs to spin in the central courtyard, and have Brooklyn Brewery truck in kegs. It is one of my favorite NYC daytrips, and I highly recommend a visit.

Their website is , and they have some nice on-line/ new media exhibits.

P.S.1 is open from Noon to 6:00 p.m. Wednesday through Sunday. Admission is a $4.00 suggested donation, $2.00 for students, and seniors members free.

PS1 is not specific to bash, but it is related only to shells based on the original Unix Bourne Shell, sh. This includes ksh, bash, ash and zsh.

The BSD Unix C shell (csh) and its derivate tcsh use another set of environment variables to define the appearance of its command prompt: prompt, prompt2 and prompt3.

Log in or register to write something here or to contact authors.