I explained how to change the colors of shell prompt.
The next thing that was bothering me was the color of "ls". The folders were listed in blue color, which is hardly visible in black background color.
It is almost same to the way you change the color of prompt. When you open the manual page of "ls", you can see that it mentions an environment variable, LS_COLORS.
If you echo the variable, it looks very like the other environment variable, PATH. Each element is separated by colon, ":". It is little cryptic and that's where another utility called "dircolors" comes in.
You can try to read manual page of dircolors but it wouldn't give you much information. It can print out what the current setting is and it can read a file to reset the setting. The file, ~/.bashrc, uses dircolors like screenshot above. It checks if the utility, dircolors, is installed at /usr/bin. It checks if you have a file, ~/.dircolors. If you have it, it will use the file as a setting for dircolors.
You can create the setting file, ~/.dircolors, by a command: dircolors --print-database > ~/.dircolors
Once you have the setting file, you can modify it as you want. The text file is more descriptive and less cryptic than the setting of LS_COLORS, itself. The color setting of directory is DIR and the default color setting is "01;34" for me. The color number of ls is same to that of prompt. 34 is blue and I like to change it to yellow (33) because MS-Windows has yellow folder icons. Once you change the setting, you can re-login and let .bashrc read the changed settings or you can directly apply it by a command: eval `dircolors ~/.dircolors`
That wasn't too hard, was it?
thanks - I couldnt see that infernal dark blue!
ReplyDeleteI always wonder, in Linux/Unix, who in the world thought dark blue on black was a good idea; this is a universal bad idea and for decades millions of users have had to change this default setting.
ReplyDelete