Skip to content

zsh on macOS 10.15 Catalina

Back when bash was the default shell for macOS, I had updated the .bash_profile file to change the prompt on my computer. Well, that doesn’t work with zsh, it seems.

In bash, I had it set by adding this line to the ~/.bash_profile file. export PS1="\d \t \w   💩  "

Now in zsh is in the ~/.zshrc file, and just copying and pasting that into it didn’t work. It doesn’t seem to like the \ commands. Turns out that it now uses % commands, but it’s not a one to one relationship, so I thought I’d map it out to try to figure out what is what, because Googling didn’t help.

Some of these just show up a number, if you know what it is, comment below, or tweet at me, or hit me up on Slack.

%c shows the current directory (~ or Desktop)

%d shows the full path (/Users/username/Desktop)

%e is showing a 0

%h is showing a 92

%i is showing a 1

%j is showing a 0

%l is showing s003

%m and %M show the computer name

%n and %C show the current user

%t shows the current time in a 12 hour clock

%w shows the current day (Mon 28)

%x and %N show the shell (-zsh)

%y shows the session (ttys001)

%D shows the date (YY-MM-DD)

%I shows 1

%L shows 1

%S seems to have inverted the colours after it.

%T shows the time in a 24 hour clock

%U underlines the text after it

%W shows the date (MM/DD/YY)

Now I set it to export PS1="%D %t %c 💩  "

Leave a Reply