
- by x32x01 ||
The GNU Bash shell is the default shell in almost every Linux distribution. Whenever you open a Terminal or log in via the console, you’re greeted by the CLI (Command Line Interface) prompt - your main access point to interact with the system.
By default, the prompt ends with the dollar sign ($), which means the shell is ready for your next command
.
For example:
This simple line actually holds a lot of meaning - and yes, you can customize it completely to display information like your username, directory, hostname, and more
.
The Bash prompt (known as PS1) is where your commands start. It can be personalized to show useful system information - like who you are, where you are, and even the time
.
Here’s what the default example means:
.
You can easily check your current prompt settings by using the echo command:
Example output:
This means your shell is configured to show:
You can also check PS2, which is used for multiline commands:
Result:
So when a command spans multiple lines, Bash uses > as a continuation prompt
.
Here’s a full list of special Bash prompt escape sequences you can use to customize your terminal.
Each one adds something unique to your prompt
:
Want to add some color and style? Try this example 
This will display your username, hostname, and current directory in green and blue, with a reset to default color at the end.
Pro Tip: To make your changes permanent, add your custom PS1 line to the
The Bash shell prompt is more than just a symbol - it’s your personalized gateway to Linux power
.
By customizing your prompt:

.
By default, the prompt ends with the dollar sign ($), which means the shell is ready for your next command

For example:
root@1[~]$
This simple line actually holds a lot of meaning - and yes, you can customize it completely to display information like your username, directory, hostname, and more

Understanding the Bash Prompt
The Bash prompt (known as PS1) is where your commands start. It can be personalized to show useful system information - like who you are, where you are, and even the time 
Here’s what the default example means:
root@1[~]$
- root → The username that started the shell
- 1 → The current virtual console number
- ~ → The current directory (~ represents your home folder)

Viewing Your Current Bash Prompt Configuration
You can easily check your current prompt settings by using the echo command: echo $PS1
Example output:
\u@\l[\W]\$
This means your shell is configured to show:
- \u → Username
- \l → Console name
- \W → Current directory name
- $ → A dollar sign (normal user) or a pound sign (# for root)
You can also check PS2, which is used for multiline commands:
echo $PS2
Result:
>
So when a command spans multiple lines, Bash uses > as a continuation prompt

Bash Prompt Variables Explained
Here’s a full list of special Bash prompt escape sequences you can use to customize your terminal.Each one adds something unique to your prompt

Code | Description |
---|---|
\a | Bell character (beep sound ![]() |
\d | Date (Day Month Date) ![]() |
\e | ASCII escape character |
\h | Hostname (short) ![]() |
\H | Full hostname ![]() |
\j | Number of background jobs ![]() |
\l | Terminal device name |
\n | New line |
\r | Carriage return |
\s | Shell name |
\t | Current time (24-hour HH:MM:SS) ![]() |
\T | Current time (12-hour HH:MM:SS) ![]() |
\@ | Current time (12-hour format with am/pm) |
\u | Username ![]() |
\v | Bash shell version ![]() |
\V | Bash shell release level |
\w | Full current working directory ![]() |
\W | Basename of current directory |
\! | History number of the command |
\# | Command number in this session |
\$ | $ for user, # for root ![]() |
\nnn | Character from octal value |
\\ | Backslash |
\[ ... \] | Begins/ends a control code (used for colors ![]() |
Example: Creating a Custom Colorful Bash Prompt
Want to add some color and style? Try this example 
Code:
PS1="\[\e[32m\]\u@\h \[\e[34m\]\W \$\[\e[0m\] "


~/.bashrc
file and reload it using: Code:
source ~/.bashrc
Wrapping Up
The Bash shell prompt is more than just a symbol - it’s your personalized gateway to Linux power 
By customizing your prompt:
- You can see system info at a glance
- Organize multiple terminal sessions efficiently
- Add colors and styles for better visibility


Last edited: