The PS1 variable defines what your primary prompt looks like (in general, the primary prompt is bash – Bourne Again SHell)

Display your system’s PS1 variable using the echo command:

# echo $PS1


The bash manual contains some information about how to configure the prompt:

  • Display the bash manual using: man bash
  • Type /PROMPTING to start a forward search
  • Press n twice


PS1 variable most useful options:
\H = display hostname
\u = display username
\w = display working directory
$ = display “$” for normal user or “#” for root user


Change the $PS1 variable:

# export PS1="\H \u \w \$"
# echo $PS1
 PS1="\H \u \w \$"

To make the custom prompt persistent across reboots, append to /root/.bashrc or /home/$user/.bashrc:

# echo 'export PS1="\H \u \w \$"' >> ~/.bashrc