Changing color of my directories listed by my directory


I tried changing the color/attributes of directory listings of ls command by editing .dircolors file but it doesn't work.

Before that it is worth mentioning that i have added the below changes in the bash.bashrc file.

# enable color support of ls and also add handy aliases if [ "$TERM" != "dumb" ]; then [ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors" [ -e "$DIR_COLORS" ] || DIR_COLORS="" eval "`dircolors -b $DIR_COLORS`" alias ls='ls --color=auto' #alias dir='ls --color=auto --format=vertical' #alias vdir='ls --color=auto --format=long' fi

Also , added the below code in bashrc for specifying the dircolors file path.

d=.dircolors test -r $d && eval "$(dircolors $d)"

I just got a vague idea about these things as am just beginning to work with ubuntu. So can someone please help me find out the reason about why am not able to change colors of ls command?


You seem to be doing some of the tests and evals multiple (unnecessary) times. Here's the standard idiom present in Ubuntu skeleton .bashrc files:

if [ -x /usr/bin/dircolors ]; then [ -r ~/.dircolors ] && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" fi

This tests whether the dircolors program is available (and executable by you) on your system. If so, then it checks whether the .dircolors file exists (and is readable) in your home directory. If so, it executes the dircolors command using your .dircolors file as input and evaluates the output (which basically just sets the LS_COLORS environment variable). If you don't have a .dircolors file, then it executes dircolors with the default colors (and once again evaluates that output).

When it's done you can check the settings it produced:


You can read a bit more about what all these colors mean by running:

dircolors --print-database


  • How to run two instances of GitBash on Windows 8?
  • Javascript: Unexpected Token ILLEGAL Error with appendChild()
  • Selecting an integer from each of the given n sets of integers such that the sum of their pairwise d
  • Java SOCKS proxy
  • Need help with Eval inside DataList
  • Calling JS from an applet works in Firefox & Chrome but not Safari
  • Julia: Can you set a time limit on eval
  • Specify source IP address for TCP socket when using Linux network device aliases
  • How does the bind operator for Eval in Control.Parallel.Strategies evaluate its argument strictly?
  • How to alias an executable using Powershell permanently?
  • Kentico Repeater HTML Properties showing with selected transformation
  • How to change display text in item template based on eval in gridview?
  • Extend Name Box
  • my tic-tac-toe program in matlab does not work [closed]
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • Installing Perl6 and Panda on Ubuntu 15.10. Problems with bootstrap.pl
  • Can my PDF ping my server when it is opened?
  • C# List of Panels
  • Hibernate to update table schema
  • List images(01.png) and descriptions(01.txt) from directory
  • Copy to all folders batch file?
  • Access variable of ScriptContext using Nashorn JavaScript Engine (Java 8)
  • Jackson Parser: ignore deserializing for type mismatch
  • How to test if a URL from an Eclipse bundle is a directory?
  • Very simple C++ DLL that can be called from .net
  • Android full screen on only one activity?
  • Change multiple background-images with jQuery
  • Accessing IRQ description array within a module and displaying action names
  • How to draw moving and Running sine wave chart using JFree chart in java?
  • Trying to switch camera back to front but getting exception
  • Websockets service method fails during R startup
  • Font Awesome Showing Box instead of Icons
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Circular dependency while pushing http interceptor
  • how to add data labels for bar graph in matlab
  • Linker errors when using intrinsic function via function pointer
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Is it possible to post an object from jquery to bottle.py?
  • Python/Django TangoWithDjango Models and Databases