bashzsh

What does the string at the beginning of a ZSH commandline mean?


The commandlines in my terminal begin with my username and a string of letters, numbers and dashes:

ben@u-081-c214 ~ % 

I understand that ~ is the path (in this case my home directory), and I guess that % means the end of that string and that the shell is waiting for my input (similar to the $ in bash), but what does the rest of the string mean?

Lines in bash used to begin with the shell name and version number:

bash-3.2$ bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)
Copyright (C) 2007 Free Software Foundation, Inc.
bash-3.2$

Lines in zsh don't:

ben@u-081-c214 ~ % zsh --version
zsh 5.9 (arm64-apple-darwin24.0)
ben@u-081-c214 ~ %

So what does that string mean? I'm on a Mac if that makes a difference.


Also, what is the name for the whole of this string before the user input (ben@u-081-c214 ~ % or bash-3.2$)? I have been searching the internet for an answer to my question, but without knowing that name I couldn't find anything related to it.


Solution

  • ben@u-081-c214 ~ % is your zsh Prompt. And

    (In bash, the prompt typically ends with $ (for normal users) or # (for root))