6

I am using Prezto + zsh as my shell. I would like to change the color of directories when I ls my directory.

For instance, here is what I currently have:

My crappy ls listing

Obviously, this is no fun, as I'm hardly able to read my directories because the blue is so dark. I'd like to change it to white or orange or something lighter.

This dark blue is specific only to directories. Files show up in a nice white text.

Where and what settings must I find to change this?


Attempted solutions:

I tried adding

eval $(dircolors -p | sed -e 's/DIR 01;34/DIR 01;36/' | dircolors /dev/stdin)

to my zshrc, but am getting this error now when loading my prompts:

Blockquote

3
  • 2
    Is this on a Mac? Macs don't have GNU coreutils, so don't have /usr/bin/dircolors. See unix.stackexchange.com/questions/91937/…
    – cas
    Commented Oct 17, 2015 at 21:51
  • It is on a Mac, yes. I'm running El Capitan also. So your solution won't work for me, will it? Commented Oct 17, 2015 at 21:56
  • not unless you install GNU coreutils. The link i posted has more info on setting ls colours on a Mac as well as info on installing coreutils.
    – cas
    Commented Oct 17, 2015 at 22:04

4 Answers 4

6

Yeah, dark blue on black is unreadable.

Find the line in your ~/.bashrc or ~/.zshrc or other profile script that looks like this:

eval $(dircolors)

and change it to this:

eval $(dircolors -p | sed -e 's/DIR 01;34/DIR 01;36/' | dircolors /dev/stdin)

That changes blue ("01;34") to cyan ("01;36")

Alternatively, edit your terminal program's colour scheme and change the Dark Blue to a more readable colour.

6
  • I don't have this line in my ~/.zshrc file. I would definitely mark this answer correct if you could illustrate further how to find this line. Commented Oct 17, 2015 at 20:29
  • According to the zsh man page, zsh uses ~/.zshenv, ~/.zprofile, ~/.zshrc, ~/.zlogin and ~/.zlogout. System-wide zsh settings are in /etc/zsh/zshenv, /etc/zsh/zprofile, /etc/zsh/zshrc, /etc/zsh/zlogin, and /etc/zsh/zlogout. The zlogout files wont be setting dircolors, but any of the others might.
    – cas
    Commented Oct 17, 2015 at 21:18
  • It doesn't really matter which of those set it. If you add the eval $(dircolors -p | sed ... line to the end of ~/.zshrc it will override any earlier definition.
    – cas
    Commented Oct 17, 2015 at 21:20
  • I attempted this solution, but ran into an error. I've edited my question to reflect this attempt. Commented Oct 17, 2015 at 21:34
  • 1
    @anh_ng8 that works (which is why i mentioned it in my last paragraph above), but is a pain if you use multiple terminals on multiple systems - you have to change the config for all of them in tedious point-and-click dialog boxes (it's what i used to do before i got annoyed enough by it to read the dircolors man page and figure out how to fix it in my .bashrc). It's easier to just not let dircolors use dark-blue on black.
    – cas
    Commented Jul 18, 2016 at 11:46
1

I was able to fix this on my Mac OS X El Capitan by installing gnu coreutils

Install Homebrew

Then install coretuils

brew install coreutils

Then set PATH in your ~/.zshrc

export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
1

A simple way is to change the ANSI Color blue in the preferences of the Terminal.app (OSX).

1
  • 2
    This answer were be much more useful if you would explain how to change the color in preferences. Commented Apr 20, 2017 at 17:12
0

To change the ANSI color in iTerm2 you could click iTerm2 pull down menu and from there go to Preferences - > Profile -> Colors -> ANSI Colors

From there choose which color you want to have for your directories or change Color presets for the Terminal completely

You must log in to answer this question.

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