0

I am trying to set the directory colors in alpine to be white.

I tried to create ~/.profile with LS_COLORS=$LS_COLORS:'di=1;44:' ; export LS_COLORS in it. But it had no effect.

I see many examples out there for doing this in BASH. But Alpine uses SH.

How can I change the color of directories in Alpine?

1
  • Are you sure that ls in Alpine respects LS_COLORS? Can you set that manually in the shell after you log in and see the expected color change? Jan 9 '20 at 20:53
3

Alpine uses SH.

Incorrect. Alpine Linux uses BusyBox, and the Almquist shell variant that is part of BusyBox.

Which is the root of the issue. BusyBox ls in recent versions has a --color option, which is documented in its user manual (q.v.). Its colour choices are hardwired into the program, and not configurable with an environment variable.

If you really want an ls command with colours that you can configure with an environment variable, you will have to install some other ls command.

Further reading

1
  • huh. OK. I did not know that. I assumed it was sh because when I connect to it I launch /bin/sh. Either way, it sounds like I have to run ls --color=never each time I want to see the directories.
    – Vaccano
    Jan 9 '20 at 22:20
0

JdeBP’s answer is absolutely right. Customizing colours is not possible in BusyBox ls. However, you can disable colours by using an alias:

export ls='ls --color=never'

can be added to /etc/profile or another similar configuration file. That way, you don’t have to type --color=never every time you use ls.

I realize that it’s not the solution you were hoping for, but it will make it easier to see directories (based on your comment, I believe that’s the issue?).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.