DEV Community

Cover image for How to Customize Zsh Command Prompt Text
CodingWith-Adam
CodingWith-Adam

Posted on

How to Customize Zsh Command Prompt Text

In this video you will learn how to customize the Z Shell(Zsh) command prompt text.

We will understand how the text is formatted using special characters. We will add color to the command prompt. This will include colors using words and 3 digit codes. We will explore what PS1 and Prompt environment variables are. Additionally we will add prompt text to the right side of the screen using RPROMPT. Lastly we will hide the "last login text" when you open a new command prompt using a special file called .hushlogin

All the changes we do here will be reflected for VSCode if zsh is your default command prompt in VSCode.

Indirectly from this fun tutorial you will learn the following commands / concepts

  • cd - change directory
  • ls - list directories
  • touch - make a file if does not exist
  • rm - remove file
  • pwd - current location
  • environment variables
  • reload zshrc file

This is the default command prompt format:

PS1="%n@%m %1~ %# "

The final Prompt and RPrompt values:

PROMPT="%F{magenta}Adam%f %U%F{yellow}%1~%f%u %F{blue}$%f "
RPROMPT="%F{241}%T%f"

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay