How can one change dircolors globally?

Chris Green cl at isbd.net
Mon Jul 30 11:05:17 UTC 2018


I suspect the answer to this may be that you can't, but I'll ask the
question anyway.

Is there any sensible/easy way to change the defaults for all users
set up by dircolors in Ubuntu?  From reading the man pages for
dircolors and dir_colors it would seem that it's not possible.

On Ubuntu (and any Debian derived system) dircolors doesn't read
either of /etc/DIR_COLORS or ~/.dir_colors so one can't change colors
by creating/changing these files.  

In addition, on Ubuntu at least, the dircolors command is run in each
users' ~/.bashrc file so even putting a dircolors command in
/etc/profile which changes the defaults won't work because it will be
overridden by the users' dircolors.

The only way I can see of doing it is to put a customised dircolors
command in /usr/local/bin which would then be run instead of the
default one at /usr/bin/dircolors.  This does seem a bit of a bodge
though.  Isn't there a better way?

I see that 18.04 does take account of a user's local ~/.dircolors file
but it still doesn't have a global file.  Earlier versions don't even
look at ~/.dircolors.

-- 
Chris Green




More information about the ubuntu-users mailing list