---

Bash Prompt Basics

“Bash prompt variables

“As anything else in the linux system also bash prompt can be
customized. Bash prompt can be customized by changing the values of
bash PS1, PS2, PS3, PS4 variables. To keep the things simple, this
article will be concerned just with PS1 and PS2 variables.

“Use echo command to see the current value of PS1 and PS2
variables.

“echo “Bash PS1 variable:” $PS1
echo “Bash PS2 variable:” $PS2

“Bash PS1 prompt variable

“PS1 is a primary prompt variable. Currently it holds u@h:w$
special bash characters. This is the default structure of the bash
prompt on many Linux systems and is displayed every time you log in
using a terminal.Please see the following section “Bash prompt
special characters” for explanation of u, h, w and $ symbols.”

Complete
Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis