How to Customize Your Shell Prompt

When I spend time working in the terminal, I like my shell prompt to display all sorts of helpful info about where I am and what I’m working on. Want to make your prompt colorful, or display your current directory, or the time, or the git branch you’re on? Here are a few resources for doing just that.

For a plainly worded introduction to the PS1 variable, what it does, and what all those backslashed special characters mean, nixCraft’s article can’t be beat. How to Change / Setup Bash Custom Prompt

NixCraft also has an article on how to change the color of your shell prompt, with tips on how to make the PS1 variable reflect a change permanently. BASH Shell: Change The Color of My Shell Prompt Under Linux or UNIX

A delightfully in-depth take on all aspects of the bash prompt, with example customizations. Bash Prompt HOWTO

Interested in displaying your current git branch in the prompt? Here’s a guide that includes a pre-written shell script you can use. Put Your Git Branch in Your Bash Prompt

Written on August 16, 2016