I am not able to change the color of dir entries for ls command (dark blu is a very annoying color to read) on my OpenWrt device. I've added the line

LS_COLORS=$LS_COLORS:'di=0;37:' ; export LS_COLORS

at the end of /etc/profile file, since OpenWrt hasn't any bashrc file, but nothing has changed.

  • 1
    Judging by source code, there probably no support for setting colors by environment variable. It only exists to toggle color output on/off. But I can be wrong, just quick look at source where getenv() is called.
    – user140866
    Dec 16, 2015 at 18:38
  • 1
    Also please note that OpenWrt uses busybox as every other embedded Linux distro, so certain features present on desktop systems usually unavailable in embedded environments.
    – user140866
    Dec 16, 2015 at 18:40

1 Answer 1


Had the same problem on a Synology NAS where directories were printed like this on my terminal:

I resorted to replacing the colors using sed. I added this to my .bashrc:

function _ls() {
  out="$(/bin/ls --color=always "$@" | sed "s/\x1B\[34;42m/\x1B\[30;42m/g")"
  echo "$out"
alias ls=_ls

To actually make the output colored, I found it necessary to store the replaced output in a variable and echoing it as well as defining an alias (instead of naming the function ls itself).

Now the output looks like this:

Different wrapping, but slightly more readable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .