How can one change dircolors globally?

Chris Green cl at isbd.net
Mon Jul 30 12:39:05 UTC 2018


On Mon, Jul 30, 2018 at 09:46:40PM +1000, Francis (Grizzly) Smit wrote:
> 
> 
> On 30/07/18 21:41, Chris Green wrote:
> > On Mon, Jul 30, 2018 at 09:14:16PM +1000, Francis (Grizzly) Smit wrote:
> >>
> >> On 30/07/18 21:05, Chris Green wrote:
> >>> 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.
> >>>
> >> I'd set LS_COLORS in /etc/bash.bashrc
> > That won't work because it will be overridden by the setting in each
> > user's ~/.bashrc.
> >
> if you wish to force the individuals choice then I suspect your out of
> luck, the whole point of Linux is user choice and GNU is the same, hence
> bash will let you set defaults, but I doubt it will let you force the
> choice, if it did it would be a bug, and would need fixing
> 
I don't want to 'force the choice', I want to change the defaults.

Other things like this tend to set defaults (which, as you say, users
can then change) in a system-wide configuration file, often these are
in /usr/share or sometimes /etc.  However dircolors (for some reason)
actually has the defaults compiled into it so they can't be changed.

-- 
Chris Green




More information about the ubuntu-users mailing list