Change ls color on OpenWrt

busyboxcolorslsopenwrt

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.

Best Answer

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.

Related Question