Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Modify sort ordering for `ls`



Hi all,

I noticed on Mac, ls -l sorts a dot (.) before alphanumerics, which I
consider to be correct for purposes of tab completion:

-rw-r--r--  1 dan  dan  0B Aug 18 13:20 VeryLongFileName.scala
-rw-r--r--  1 dan  dan  0B Aug 18 13:20 VeryLongFileNameHelper.scala

Whereas on Ubuntu, ls -l gives the reverse:

-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileNameHelper.scala
-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileName.scala

On the flip side, Zsh on Mac sorts a dot after a dash (-), which for
purposes of tab completion feels unnatural:

-rw-r--r--  1 dan  dan  0B Aug 18 13:22 data-extra.bin
-rw-r--r--  1 dan  dan  0B Aug 18 13:22 data.bin

On Ubuntu, this behavior is again reversed:

-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 data.bin
-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 data-extra.bin

Is it possible to manually specify (say, in .zshrc or an LS_* env var) the
sort ordering? If not, can this feature be added?

Regards,

Daniel Li

*Daniel Li*
Senior Backend Engineer at Tubi TV

560 Mission St, Suite 1301

San Francisco, CA 94105


Messages sorted by: Reverse Date, Date, Thread, Author