Why isn't my zsh ls colorful?

Solution 1:

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...)

Solution 2:

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'
  fi

# 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