1

I want my zsh shell to look exactly like bash shell(in terms of default coloring) but my zsh shell's text is plain white. I identified this part of .bashrc which I think adds the green color to user@pc:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

but pasting this in zshrc doesn't work unlike these commands:

if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

I don't really know a lot about linux, any help would be appreciated!

2 Answers 2

8

This comes more or less close to the Ubuntu bash PS1

.zshrc:

alias ll='ls -al'

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

autoload -U colors && colors
PS1="%{$fg[green]%}%n@%m%{$reset_color%}:%{$fg[cyan]%}%1~%{$reset_color%} %% "
1
  • Perfect, thanks! Can you explain whats going on in the last line?
    – Pythoner
    Mar 10, 2022 at 2:04
0

In case you want to have the absolute path displayed on your prompt, instead of only the relative one, add the following line to your .zshrc file:

PS1='%B%F{green}%n@%m%f:%F{blue}%/%f$vcs_info_msg_0_$%b '

I also think my attempt is a lot closer to the look of Ubuntu's default prompt than the accepted answer, since the text is bold and it uses $ instead of % as the "separator"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .