hi, so yeah, export LS_OPTIONS='--group-directories-first --color=auto' don’t do what I expected it to do
how do I use it? thank you in advance for your replies.
hi, so yeah, export LS_OPTIONS='--group-directories-first --color=auto' don’t do what I expected it to do
how do I use it? thank you in advance for your replies.
I would think space in the beginning would matter
You can experiment with the setting without having to fiddle with export
$ LS_OPTIONS=' --group-directories-first --color=auto'
$ ls $LS_OPTIONS ~/
Played around with it - a globl LS_OPTIONS environment variable appears to be ignored on Manjaro, it could be something that is specific to another distribution e.g. Ubuntu - but I don’t really know.
Looking at the ls(1) — Arch manual pages there is no mention of LS_OPTIONS only LS_COLORS
If you have multiple parameters you must define it as bash array eg.:
LS_OPTIONS=("--color=auto" "--group-directories-first")
Use an array like @tomek said.
However the export will only work until you logout or reboot. If you want it to be permanent, you should to add it to your ~/.zshrc
echo 'export LS_OPTIONS=("--color=auto" "--group-directories-first")' >> ~/.zshrc
As it turns out, this (perhaps) little known feature is part of Manjaro’s zsh config. I found it in /usr/share/zsh/manjaro-zsh-config (last 4 lines).
# File and Dir colors for ls and other outputs
export LS_OPTIONS='--color=auto'
eval "$(dircolors -b)"
alias ls='ls $LS_OPTIONS'
Ahh - I see - searched in manuals - but since I don’t use zsh - it went completely over my head
thank you.
I do use zsh, but I have a custom config so it didn’t work for me either.
The fact they got an error made me think it might be in the default config.
what if I want to append? can I expect LS_OPTIONS+=( something );export LS_OPTIONS to work despite LS_OPTIONS not being an array to begin with?
The command I gave adds this line
export LS_OPTIONS=("--color=auto" "--group-directories-first")
to the end of your ~/.zshrc - so it is an array. Normally to append something you’d just edit that line
export LS_OPTIONS=("--color=auto" "--group-directories-first" something)
That means it’s run every time you open a shell - so it always applies to all shells.
Or you can append it temporarily for the current shell only.
LS_OPTIONS+=(something)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.