I'm using zshell in fedora 33 OS.

I've the configuration in my ~/.zshrc file

Whenever I run ls command I get below error -

ls: unparsable value for LS_COLORS environment variable

How can I fix this error?

LS_COLORS is correct when I do echo.

M. ~ 
○ echo $LS_COLORS
  • 1
    No, LS_COLORS is not correct. ls tells you it's wrong. You need semicolons between entries. Read man ls.
    – waltinator
    Commented Aug 16, 2021 at 0:44
  • @waltinator - thanks for your kind comment. Could you please let me know semi colon needed between which entries? Commented Aug 16, 2021 at 1:02
  • 1
    The correct syntax is like rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:... -- as produced by dircolors, see the man page; note that's colons between entries and semicolons between values within an entry. Commented Aug 16, 2021 at 1:52

2 Answers 2


There are (at least) two common formats for ascribing colors to the output of ls. Your variable appears to contain the BSD-style format, which usually is given to the LSCOLORS environment variable. GNU tools use a different format (and helpfully renamed the variable to LS_COLORS).

You can use the dircolors tool to create an appropriate setting for the GNU-style variable.

  1. Start a shell

  2. Run unset LS_COLORS

  3. Run dircolors -p > ~/.dircolors

  4. (optional) edit ~/.dircolors to use the colours you prefer. It's nicely commented and fairly easy to figure out. If you use vim to edit it, syntax highlighting rules will show you what the colour codes will look like as you edit them.

  5. Add the following to your ~/.zshrc (and/or ~/.bashrc or ~/.bash_profile if you're using bash) to cause your colour definitions to be loaded when a shell is started:

     [ -e ~/.dircolors ] && eval $(dircolors -b ~/.dircolors) || eval $(dircolors -b)

    Note 1: This should replace any existing code in ~/.zshrc that acts to set LS_COLORS

    Note 2: You can make this system-wide (i.e. affecting all users) by editing the appropriate shell startup files under /etc instead of (or as well as) those in your home dir. Read the man page for your shell for details.

  6. This will only affect shells started after these changes. To affect any currently running shell, run the same line in each terminal

You must log in to answer this question.

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