The PS1 environment variable in Linux defines the primary prompt string displayed in your terminal. By default, it is often plain or bloated. Customizing it helps you identify your current host, active directories, and active Git branches at a glance.
Use this interactive builder to design your custom terminal prompt, preview it in real time, and copy the code to add to your .bashrc.
Interactive Prompt Builder
[ PS1 GENERATOR ]
Select a Preset:
Prompt Components:
Element Colors:
Username:
Hostname:
Directory:
Git Branch:
[ LIVE TERMINAL PREVIEW ]
---
### Prompt Format Codes Reference
When writing your own prompt string in Bash, you can use these escape sequences:
| Code | Output |
| :--- | :--- |
| `\u` | Username of the current user |
| `\h` | Hostname of the local machine (up to the first `.`) |
| `\H` | Full hostname of the local machine |
| `\w` | Current working directory relative to home `~` |
| `\W` | Basename of the current working directory |
| `\d` | Date in "Weekday Month Date" format (e.g. "Fri Jul 3") |
| `\t` | Time in 24-hour HH:MM:SS format |
| `\A` | Time in 24-hour HH:MM format |
| `\n` | Newline character |
| `\$` | `#` if executing as root, otherwise `$` |