default-settings icon indicating copy to clipboard operation
default-settings copied to clipboard

Make Bash ls match Files sorting

Open danirabbit opened this issue 8 years ago • 6 comments
trafficstars

Migrating an issue report from Terminal.

It looks like the recommended way to do this is to create an alias. Maybe something like:

ls --color -h --group-directories-first

danirabbit avatar Nov 22 '17 18:11 danirabbit

This will not address the sort order of hidden files, though. I think bash follows the current LC_COLLATE setting? But Files overrides this and always sorts files whose names begin with "." after other characters. If this is not the desired behaviour then an issue should be raised against Files.

jeremypw avatar Nov 22 '17 18:11 jeremypw

So it looks like in order to make Terminal match Files for dot files we'd have to patch whatever provides /usr/share/i18n/locales/iso14651_t1_common to something like this where instead of having "ignore" we need to tell LC_COLLATE which character dot comes after. It would be nice if they matched, but it sounds complicated.

I think Files behavior here is probably as we expect :)

danirabbit avatar Nov 25 '17 05:11 danirabbit

You could also consider using an alternative for ls, two examples that come to my mind are ls-go and exa. The screenshot below show ls-go with the exact search order you expect if I'm correct.

ls-go

The alias in my shell-config for the above behaviour is [[ -x $GOPATH/bin/ls-go ]] && alias ls=ls-go\ -SL

neur0manc avatar Jan 25 '18 09:01 neur0manc

Good idea @neur0manc, but I don’t think users have a $GOPATH by default.

jepotter1-archive avatar Apr 30 '18 00:04 jepotter1-archive

@jwinnie [[ -x /usr/local/bin/ls-go ]] && alias ls=ls-go\ -SL would be the real life example if they were considering using ls-go.

neur0manc avatar Apr 30 '18 07:04 neur0manc

Gonna punt since this is an enhancement not a release blocker

danirabbit avatar May 01 '18 16:05 danirabbit