Zsh prompt with current working directory

See the EXPANSION OF PROMPT SEQUENCES and SIMPLE PROMPT ESCAPES sections of the zsh manual page at man zshmisc.

This prompt string, PS1='%m %1d$ ', displays the machine name (%m) and the trailing component of the current path (%1d).


The best version of the combinations that works for me is this:

PS1='%n@%m %~$ '

%n is the user logged in

%m is the machine name

%~ gives the path relative to HOME, if path begins with HOME.

This is how it is for me:

This is how it is for me

The man page has more info. I tried to put in simpler terms here.! :D