You are not logged in.
Pages: 1
Hello!
I want to set ls command colors, but i have some issues.
------------------
I executed these commands:
$ dircolors --print-database > /etc/DIR_COLORS
$ eval $(dircolors /etc/DIR_COLORS)
$ dircolors --print-database > /etc/LS_COLORS
$ eval $(dircolors /etc/LS_COLORS)
$ dircolors --print-database > $HOME/.dir_colors
$ eval $(dircolors $HOME/.dir_colors)
I logged out and logged in again, but it didn't work.
What should I do?
Offline
Where did you get those commands and what do you expect them to do?
Are you getting colors at all with `ls` and you want to customize the colors, or are you not getting color at all? Have you set any alias for `ls` or how are you testing the colors?
Please read the wiki:
https://wiki.archlinux.org/title/Color_ … console#ls
Last edited by Trilby (2024-02-28 14:24:49)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I use this in ~/.profile to change directories from dark blue to light blue:
eval "$(dircolors)"
export LS_COLORS=$LS_COLORS:'di=00;94:'Jin, Jîyan, Azadî
Offline
Hello, Trilby!
I get those command from "baeldung" for set ls colors.
When i run ls, the ls shows compressed files in white.
While it should show compressed files in red.
Offline
Have you looked at any of the files you've written and are now evaluating?
If you want to change the colors, you'll have to edit that file, https://www.baeldung.com/linux/ls-outpu … irectories actually even explains that.
You can write /etc/DIR_COLORS only as UID0, so thats not a good location for the file.
Offline
Additionally, exporting these colors to multiple files serves no purpose (other than creating filesystem clutter). More relevantly, the "eval ..." command applies to the current shell. So running that in an interactive session then logging out and back in again is completely pointless and will do nothing at all. The bull-dung (sorry baeldung) page does not cover this point at all and is a bit misleading in that regard.
But again, running just `ls` without any flags makes all of the above points completely irrelevant. Unless you specify `ls` should use colors, the contents of LS_COLORS are not used (another point not covered by that bull-dung article).
Last edited by Trilby (2024-02-29 14:04:11)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1