None of the answers here include the 256 color options in the latest versions of Ubuntu. I'm color deficient (some colors give me trouble near each other) so the default blue directory on black is real hard for me to read. What follows is my research to change that.
Type dircolors -p |less
to see your current color code.
The default .bashrc should already be configured not only to take advantage of the system color code, but also one in ~/.dircolors so dump the dircolors output to .dircolor so you can start with that using this command.
dircolors -p > ~/.dircolors
Alternative: pick up a very similar 256 color dircolors from seebi's solarized project.
Grab this colortest script and run it with the command colortest -w
so you can see all the colors at once. Choose a color. I like the orange #208. I want that to be the text color so using this info on extended color codes, I can apply that.
So you have a color, now what. First we have to create the string.
The first number will be an attribute code, most likely 00, but if you want it to blink go with 05:
Pick an attribute code: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
Next pick append ;38;5;
to that attribute code to indicate your text color to get 00;38;5; and then append your color. I picked 208 so I get 00;38;5;208
.
If you want to also put a background on it, pick another color (let's say 56) with the colortest script and the append ;48;5;
for the background and 56 for the color to get a total string of 00;38;5;208;48;5;56
.
So now you have it, what do you do with it?
vim ~/.dircolors
and find the section you want to change (for me that is DIR) to the string we determined above "00;38;5;208".
This won't apply immediately, you'll need to load the config. Use dircolors ~/.dircolors
to the get code to set your LS_COLORS variable. You could just paste that into your terminal session or you can close your terminal and reopen it. You could also pipe that into a file and run it as a shell script.
You can do this same procedure with 16 colors. You don't need the special ;38;5 or ;48;5 stuff. Just toss the numbers into the string and enjoy the simplicity.
Thanks to Dan and seebi for their notes and code on this.