Mark Thomas Miller's logo

Minimalistic terminal prompt with zsh

July 11, 2020

A minimalistic terminal prompt

Every time I set up a new machine for development, one of the first things I do is customize the prompt in Terminal. The default is a little too busy for me:

Default terminal prompt

In this post, we'll hide the "Last login" message and the noisy information about the current user to make it look more like the first image in this post. First, you'll want to open up your .zshrc file. If you don't know where to find this, just open up your terminal and run:

touch ~/.zshrc && open ~/.zshrc

This will open up .zshrc in TextEdit. Add this, and save the file:

export PS1="%1~ ❯ "

Now close and reopen the terminal, and it will be a minimalistic prompt that only shows your current directory. (If you see ~, that means you're in the root directory for the user.)

Minimalistic home prompt

And if you want to remove the "Last login" message from Terminal, you can create a .hushlogin file in your root directory. The existence of this file will be enough to silence the message. To create this programmatically, just run this command in the terminal:

touch ~/.hushlogin

And that's that. You now have a minimalistic prompt.