© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
David R. Myers
Senior Software Engineer
The goal of this article is to teach you just enough about the shell prompt to make some helpful customizations. What is the shell prompt? The prompt is the bit of text that shows up in our shells to indicate that we can interact with them. The prom...
Very useful, thanks. I just bought a new mac and it defaults to zsh, so figured I might as well as make the leap from Bash to Zsh.
Only comment I'd make is you need to include:
setopt prompt_subst
else the $vcs_info_msg_0_ won't get expanded in the prompt. With your help and a little more searching I ended up with:
$vcs_info_msg_0_
autoload -Uz vcs_info setopt prompt_subst precmd () { vcs_info } zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' unstagedstr '%F{red}*%f' zstyle ':vcs_info:*' stagedstr '%F{green}*%f' zstyle ':vcs_info:*' formats ' (%F{blue}%b%u%c%f)' PS1='[ %B%n%b@%B%m%b:%F{green}%/%f$vcs_info_msg_0_ ] $ '
Matthew Lowe
WordPress web developer
If you found this article useful or you found it lacking, please let me know! I'd love to improve my writing and improve this resource for you all. I'm just a quick comment away. 😁
Very useful, thanks. I just bought a new mac and it defaults to zsh, so figured I might as well as make the leap from Bash to Zsh.
Only comment I'd make is you need to include:
setopt prompt_substelse the
$vcs_info_msg_0_won't get expanded in the prompt. With your help and a little more searching I ended up with:autoload -Uz vcs_info setopt prompt_subst precmd () { vcs_info } zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' unstagedstr '%F{red}*%f' zstyle ':vcs_info:*' stagedstr '%F{green}*%f' zstyle ':vcs_info:*' formats ' (%F{blue}%b%u%c%f)' PS1='[ %B%n%b@%B%m%b:%F{green}%/%f$vcs_info_msg_0_ ] $ '