Messing with LS_COLORS
Before and after
I’ll first set
LS_COLOR='' Below, you’ll see that nothing is colored, except for the directories which are blue, because of another environment variable called DIR_COLORS. We are going to learn how to tell LS_COLORS to colorize files by name.
I usually had colored by files by whether or not they were executable, a symbolic link, etc, which something like
LS_COLORS='di=96:fi=0:ln=33:ex=1;92' which sets
- directories to 96 (cyan)
- files to 0 (default)
- links to 33 (yellow)
- executables to 92 (green)
and so on.
I realized recently you can set LS_COLORS to colorize files by name. This is useful in times where you know many types of files will be present in a directory and you want to see what they are right away. Or even if its not that useful, it’s still pretty cool.
Here I know I have .tex, .aux, .log, .bib, .png, .zip, and .pdf all in this directory. I do
Notice how you can set bold and a color with 1;COLOR.
Since you can take this to extremes, I did. I quite like it – I use colored pens in real life, so when I discovered this, I just had to …
🙂 Enjoy the pretty prompts!