From the course: Learning Zsh
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Customizing the prompt
- [Instructor] So far in this course, we've seen the Zsh prompt as the machine name and the percent sign or a pound sign for the superuser followed by a space. But the prompt can be changed to include other useful information and even to have colorful styles. If you work with the shell a lot, it can be nice to surface some more information and to personalize the prompt in a way that appeals to you. In order to change the prompt, we'll modify the prompt environment variable. Let's take a look at what it's currently set to with echo $PROMPT. This formatting string uses some placeholders for specific pieces of information. %m represents the machine's local name and %# represents the percent sign when we're acting as a regular user and shows a pound sign when we're acting as root or using superuser privileges. While there are many placeholders you can use, we'll take a look at just a few here to get a sense of how…