Changing terminal colors for normal files when ls -G or within .bash_profile So I followed this thread (Changing terminal color) and got all of the colors working for directories and such, except however, for normal files such as a Gemfile or .txt files or .java files or .rb files etc... I was wondering how I can get normal files to show up in color, even better if I can get different extensions of the file to show up in different colors as well. Let me know if you guys have any resources for this.
I don't think colorizing the file names of regular files is possible with ls alone (i.e. without postprocessing the output with another script):


The manual page for ls (shown when you type man ls) does not mention this possibility.
I would expect that the ls coming with Mac OS X is very similar to the BSD version of ls, since there seems to be little motivation for Apple to make changes in this area.  The source code for BSD's ls is available online, e.g. the FreeBSD version is on GitHub.  The function which selects the color for a file name is colortype() in the source file bin/ls/print.c.  And checking the source code it is clear that at least the BSD version of ls does not have the ability to change color when printing the names of a regular file.