Hacker News new | ask | show | jobs
by torstenvl 1023 days ago
I like vanilla `ls` but I do miss some display options from GNU ls when I'm on Mac, e.g., grouping directories first.

Luckily, of course, it's open source, so I just added the options I needed.

https://github.com/torstenvl/betterls if anyone is interested

exa seemed like overkill for my needs, and it was easier to add a couple lines of code than to learn a whole new tool.

3 comments

It's also a whole other tool and in Nim to boot, but https://github.com/c-blake/lc allows you to group "dot-directories" before "dot-files" before "non-dot directories" before non-dot files.

There might be enough other new functionality such as abbreviation or multi-attribute colorization schemes to motivate learning a new tool. E.g., neither "dot-ness" nor "directory-ness" in the above is hard-coded. They could be any other convenient elements of the typology / taxonomy.

You could also just install coreutils via brew...
Last I checked, GNU coreutils don't know anything about, e.g., macOS extended attributes.

I specifically wanted to stay close to stock because macOS `ls` is designed for the system it runs on. Installing coreutils would be counterproductive.

on mac I do this:

    alias ls='LC_COLLATE=C \ls -F'
doesn't sort dot directories before dot files, but it's good enough