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

Cole Bittel
  • 181
  • 1
  • 2
  • 7
  • 2
    Is this on a Mac? Macs don't have GNU coreutils, so don't have `/usr/bin/dircolors`. See http://unix.stackexchange.com/questions/91937/mac-os-x-dircolors-not-found – cas Oct 17 '15 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? – Cole Bittel Oct 17 '15 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 Oct 17 '15 at 22:04

4 Answers4

5

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.

cas
  • 1
  • 7
  • 119
  • 185
  • 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. – Cole Bittel Oct 17 '15 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 Oct 17 '15 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 Oct 17 '15 at 21:20
  • I attempted this solution, but ran into an error. I've edited my question to reflect this attempt. – Cole Bittel Oct 17 '15 at 21:34
  • Agreed. When Dark Blue is not readable, simply edit the terminal program to change it to a more readable color. – anh_ng8 Jul 18 '16 at 07:45
  • 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 Jul 18 '16 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"
Sameer
  • 11
  • 1
0

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

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