I just recently switched to the fish shell from bash and I am having trouble sourcing my dircolors template file to get custom colors to appear for certain file extensions.

In bash, I was sourcing a template from ~/.dircolors/dircolors.256dark. The dircolors.256dark template has different file types mapped to different colors. For example, when I use ls, all .wav files will appear in orange. This was being sourced in my ~/.bash_profile like so:

# uses dircolors template
eval $(gdircolors ~/.dircolors/dircolors.256dark)

# Aliases
alias ls='gls --color=auto'

However, fish doesn't really use an rc file but instead sources from a config.fish, file but the syntax for certain operations is different in fish.

I'm trying to figure out how I would be able to accomplish this in fish. I like being able to visually distinguish different file types by color so this could potentially be a deal breaker for me if there is no way of doing this in fish.


For clarity, I am not trying to simply change the colors of directories or executable files, but files with different file extensions. For example if I did ls in a directory, I would get the following:

my_file.py  # this file would be green for example
my_file.js  # this file would be yellow
my_file.wav # this file would be orange

EDIT: I used homebrew on macOS for dircolors.

1 Answer 1


The solution was actually pretty simple. Within my ~/.config/fish/config.fish file, I just needed to drop the "$" from the eval statement. So it would look like this:

# uses dircolors template
eval (gdircolors ~/.dircolors/dircolors.256dark)

# Aliases
alias ls='gls --color=auto'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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