8

So I just installed Zsh, and it shows for each command arrow and then ~. How do I enable my username@computername or something similar? I am reading https://wiki.archlinux.org/index.php/zsh but cannot figure this out.

That's how it looks now: enter image description here

  • Just a comment: You can install Oh-my-zsh and that includes LOTS of zsh "themes" that have different prompt styles, looks, and colors. – AlexFullinator Mar 09 '22 at 13:06

4 Answers4

14

The prompt is configured in your ~/.zshrc file setting the variable PROMPT. For example, to have your username and host followed by a "dynamic" %:

~ PROMPT="%n@%m%# "
romano@samsung-romano% 

The whole set of customization is available in the, as ever, wonderful Arch documentation.

Anyway, I warmly advise the usage of liquidprompt --- notice that once installed it will install a mechanism to control the prompt so that changing the PROMPT variable will not work anymore.

Rmano
  • 31,947
  • Thanks Rmano, for some reason my zsh is messed up. I cannot change as you said (even thought I know it's supposed to work), mane commands do not work either in the shell for some reason. – user1880405 Jun 16 '14 at 07:11
  • This is an awesome answer, it solution works for me :P . Thank you. – Chofoteddy Apr 12 '16 at 22:18
0

I know this is an old question but I may help you understand what had happened here.

By the picture you attached, it looks like you had installed Oh My Zsh on your machine.

You could have:

  1. customized the prompt by choosing one of the integrated themes
  2. created a custom theme
  3. uninstalled Oh My Zsh altogether and set the PROMPT variable like @Rmano described in his answer
0

https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

In order to enable a theme, set ZSH_THEME to the name of the theme in your ~/.zshrc, before sourcing Oh My Zsh; for example: ZSH_THEME=robbyrussell If you do not want any theme enabled, just set ZSH_THEME to blank: ZSH_THEME=""

ZSH_THEME="agnoster"

diego
  • 1
-1
  • Open up a terminal and type:

    nano ~/.bashrc
    
  • Then copy the code and paste at the end of the file.

    export PS1="\u@\h \[$(tput sgr0)\]"
    
  • Save and exit by pressing CTRL X Y and Enter.

  • Finally, type source ~/.bashrc and you will be able to see the changes.

Tejas Lotlikar
  • 2,945
  • 5
  • 17
  • 26