Spin up a new 16.04 server instance, install zsh, chsh to zsh, create the default .zshrc, log back in, ls output is not in colors. The .zshrc does seem to have all the proper dircolors and LS_COLORS stuff by the look of it, but then I'm not a zsh expert.

What am I missing?

  • Maybe --color.
    – fkraiem
    Apr 9 '17 at 2:23
  • Whats the output of type -a ls?
    – heemayl
    Apr 9 '17 at 3:11

OK, so all I had to do was alias ls='ls --color'. Thanks to the folks in comments for pointing out that I'm being an idiot. :-)

(But why have I not had to do this before? I had always thought that ls by default is in color mode...)


ZSH outputs aren't colorful like bash outputs because the commands like ls,grep aren't colorful by default, bash has default aliases to make them colorful

To get the same colors in zsh as bash, add these lines to .zshrc Execute gedit $HOME/.zshrc to open .zshrc (use your editor in place of gedit)

# enable color support of ls and also add handy aliases
  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'

# some more ls aliases
    alias ll='ls -alF'
    alias la='ls -A'
    alias l='ls -CF'

(This is from .bashrc)

restart zsh and now the command outputs should be similar in bash

Not the answer you're looking for? Browse other questions tagged or ask your own question.