How can one change dircolors globally?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How can one change dircolors globally?

Chris Green
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

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: How can one change dircolors globally?

Francis (Grizzly) Smit


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
--

   .~.     In my life God comes first....
   /V\         but Linux is pretty high after that :-D
  /( )\    Francis (Grizzly) Smit
  ^^-^^    http://www.smit.id.au/


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: How can one change dircolors globally?

Chris Green
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.

--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: How can one change dircolors globally?

Francis (Grizzly) Smit


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

--

   .~.     In my life God comes first....
   /V\         but Linux is pretty high after that :-D
  /( )\    Francis (Grizzly) Smit
  ^^-^^    http://www.smit.id.au/


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: How can one change dircolors globally?

Chris Green
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

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: How can one change dircolors globally?

Oliver Grawert
In reply to this post by Chris Green
hi,
Am Montag, den 30.07.2018, 12:05 +0100 schrieb Chris Green:
> I suspect the answer to this may be that you can't, but I'll ask the
> question anyway.

the defaults are set in /etc/skel/.bashrc but since this is only copied
over into the users home at user creation, it will only affect newly
created users. for the existing users a script that sed's through all
of /home/*/.bashrc is your only hope i fear (and super risky indeed).

ciao
        oli
--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How can one change dircolors globally?

Chris Green
On Mon, Jul 30, 2018 at 03:05:51PM +0200, Oliver Grawert wrote:

> hi,
> Am Montag, den 30.07.2018, 12:05 +0100 schrieb Chris Green:
> > I suspect the answer to this may be that you can't, but I'll ask the
> > question anyway.
>
> the defaults are set in /etc/skel/.bashrc but since this is only copied
> over into the users home at user creation, it will only affect newly
> created users. for the existing users a script that sed's through all
> of /home/*/.bashrc is your only hope i fear (and super risky indeed).
>
Yes, exactly, it's horrible!


--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: How can one change dircolors globally?

C de-Avillez-2
In reply to this post by Chris Green
On Mon, 30 Jul 2018 13:39:05 +0100
Chris Green <[hidden email]> wrote:

> 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.

dircolors does give one the option of reading an external colour
database, so having an internal, compiled-in colour setup is not really
a problem. In other words, I do not quite see this as a failure of
dircolors.

Anyway, I see two possible solutions for the future:
* a change in /etc/bash.bashrc that will cause bashrc to try a
  local dircolors.db file before sourcing a system version of it;
* a change in coreutils that will cause it to do something equivalent.

I think (but may be wrong) that it might be easier to get the first
option (a change in Ubuntu, also requiring a bug to be opened, and a
good explanation of why this is good for *all* -- remember you are
proposing a change that will affect all users).


For the second option, you should email [hidden email] (*not*
[hidden email], this is not really a bug) and present you case
there.

No matter what, both will (if one of them is accepted) change the
future, not the current released *Ubuntu versions.

Apart from these options, I really do not see anything we can do here.

Cheers,

..C..

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

attachment0 (849 bytes) Download Attachment