Is it my imagination, or did /bin/ls used to sort by case? Now it puts, for example, "README" down among the "r"s instead of before all lowercase filenames. When did this change? Is this a concession to Windows case-insensitivity or something?

From: [identity profile] jfb.livejournal.com


Google knows. (http://www.google.com/search?q=case-sensitive+ls+linux+sorting&btnG=Search&hl=en&lr=&ie=UTF-8) Looks like it's actually a concession to internationalization; it turns out ASCII sorting doesn't make sense for everyone. You can force it back, though.

From: [identity profile] dougo.livejournal.com


OK, "setenv LC_COLLATE POSIX" works. I'm not sure I want all sorting to be in ASCII order, though, just ls. I guess eventually I'll find out what other programs respect locale.

By the way, here's a footnote from the ls info page:
   (1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to
`en_US'), then `ls' may produce output that is sorted differently than
you're accustomed to.  In that case, set the `LC_ALL' environment
variable to `C'.
I guess the defaults changed or something, because I don't have `LC_ALL' set.

From: [identity profile] ghudson.livejournal.com


It's more common to have LANG set than LC_ALL. As I understand it, LC_ALL overrides {LC_COLLATE/LC_TIME/etc.} which overrides LANG, so you'd only set LC_ALL if, say, you're a script and want predictable output behavior.

(Unix locale stuff is very confusing and poorly documented in my experience. Fortunately, the average user only has to interact with it through a language-selection screen at system install time.)

From: [identity profile] mshonle.livejournal.com


alias ls (setenv LC_COLLATE POSIX; ls \!*)

(or something to that effect)

From: [identity profile] fin9901.livejournal.com


Things like that are why I'm glad I stick to BSD whenever possible. :-)
.

Most Popular Tags

Powered by Dreamwidth Studios

Style Credit

Expand Cut Tags

No cut tags