As @Matt has corrected me, this is possible using dir_colors
. To do this you need to add a line similar to this in one of a few locations.
- /etc/DIR_COLORS
- $HOME/.dircolors
excerpt from man page
found in a system default shell initialization file, like /etc/profile or
/etc/csh.cshrc. (See also dircolors(1).) Usually, the file used here is
/etc/DIR_COLORS and can be overridden by a .dir_colors file in one's home
directory.
These files are typically sourced from these files that are patched into your $HOME/.bashrc
and $HOME/.bash_profile
, assuming you're using Bash as your shell.
$ ls -l /etc/profile.d/|grep colorls
-rw-r--r--. 1 root root 1133 Nov 3 2010 colorls.csh
-rw-r--r--. 1 root root 1143 Nov 3 2010 colorls.sh
If you add your line to say your copy of $HOME/.dircolors
:
_config 01;31
You can then update your environment using this command:
$ source /etc/profile.d/colorls.sh
You can then confirm that your environment now includes the change:
$ env|grep -o '*_config=01;31'
*_config=01;31
Finally you can test to see if your change is working:
$ touch afile_config
ls -l afile_config
