Another solution would be to make a very simple change through a framework such as oh-my-zsh
, as explained in this question:
If you use the oh-my-zsh framework for instance, depending on the theme you chose to use, you'd only have to replace the %c
character with %~
. The reason being that %c
shows the current folder, while %~
shows the full path from the root.
The file where you'd want to make the change would be something like:
~/.oh-my-zsh/themes/<chosen_theme>
In my case, same as the linked question, I've selected the robbyrussell theme, so the file I had to modify was:
~/.oh-my-zsh/themes/robbyrussell.zsh-theme
For safety, you can also copy the original PROMPT=
line at the end of~/.zshrc
before customising your theme.
\u@\H [\w]$
, not the correspondent values