1

I can't decipher the folder names when using ls. The file names are good. The problem is the green highlight (color surrounding the text) which makes it unreadable. I tried changing the text color in preferences, but that doesn't work. It only appears for some folders. For some directories, though, the folder list appears normally. Attaching both for reference. I don't know what's wrong.

Images for reference:

ls in some directory:

ls in some directory

ls in my home directory: ls in home dir

1 Answer 1

2

The green background appears when the permissions of a directory allow write access for others.

One simple option is to omit coloring and use classification markers to differentiate entries:

ls --color=none -F

Alternatively, change the color for ls. The settings are stored in the $LS_COLORS variable. Use echo $LS_COLORS to take a look. It stores colon-separated color settings for specific cases of files or directories.

The entry of interest is ow=34;43 which stands for "other writable directory" and the color codes of foreground (34=blue) and background (42=green).

Maybe change it to 1;97;45 for a bold white font on purple background?

To do so, add an entry to your shell-rs-file, Assuming bash it would be in ~/.bashrc as:

export LS_COLORS="${LS_COLORS}ow=1;97;45:"

In case the original LS_COLORS does not end with a colon, use

 export LS_COLORS="${LS_COLORS}:ow=1;97;45:"

instead. I.e. ensure that the entries are separated by a colon.

Re-source it via . ~/.bashrc and run the ls-command.

Maybe just test it in a terminal beforehand by just running the export command and ls.

More details in this very nice answer on Askubuntu.

2
  • Do you mean bashrc file, not bashrs. I figured the color=None, but as you mention in the latter part, folders aren't differentiated. exporting says, unparsable value for LS_COLORS.
    – kramer
    Jun 8, 2021 at 17:32
  • @kramer Yes bashrc, a typo. Regarding the error: probably the definitions were not properly colon-separated, check the other option with prepending colon. Otherwise also ensure to use existing color codes only!
    – FelixJN
    Jun 8, 2021 at 17:58

You must log in to answer this question.

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