Article View: comp.unix.shell
Article #399Re: Time-stamping files
From: Keith Thompson
Date: Wed, 18 Nov 2026 00:08
Date: Wed, 18 Nov 2026 00:08
30 lines
2625 bytes
2625 bytes
Nuno Silva <nunojsilva@invalid.invalid> writes:
> On 2026-11-17, Keith Thompson wrote:
[...]
>> Reading the GNU coreutils ls documentation, I don't see any mention
>> of how `ls -tr a b` orders its output when a and b have the same
>> timestamp. I speculate that if the timestamps are the same, it
>> falls back to locale-specific alphabetical sorting -- and since
>> the `-r` (`--reverse`) option was given, it sorts b before a.
>> Someone could examine the source code.
>
> If it doesn't fall back to that, it should, at least if I'm reading
> right. IEEE 1003.1-2008 says it should sort by "filename in the
> collating sequence":
>
> ยซโt Sort with the primary key being time modified (most recently
> modified first) and the secondary key being filename in the
> collating sequence. [...]ยป
>
> 2024 at opengroup.org has the same:
> <https://pubs.opengroup.org/onlinepubs/9799919799/utilities/ls.html>
[...]
You're right. POSIX does specifies that `ls -tr` uses the filename
in the collating sequence as the secondary key. The GNU coreutils
documentation doesn't specify that (unless I missed something),
but it does behave that way.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Technical Details
Message-ID:
<11diqaf$telh$1@kst.eternal-september.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mailReferences:
<11d957u$1fnqs$1@dont-email.me> <11dg5gc$3vgth$3@kst.eternal-september.org> <11dgtp9$34tb9$3@dont-email.me> <11dihk2$q4aj$1@kst.eternal-september.org> <11dipjq$sq2d$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson <Keith.S.Thompson+u@gmail.com> Newsgroups: comp.unix.shell Subject: Re: Time-stamping files Date: Tue, 17 Nov 2026 16:08:47 -0800 Organization: None to speak of Lines: 30 Message-ID: <11diqaf$telh$1@kst.eternal-september.org> References: <11d957u$1fnqs$1@dont-email.me> <11dg5gc$3vgth$3@kst.eternal-september.org> <11dgtp9$34tb9$3@dont-email.me> <11dihk2$q4aj$1@kst.eternal-september.org> <11dipjq$sq2d$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 18 Nov 2026 00:08:48 +0000 (UTC) Injection-Info: kst.eternal-september.org; logging-data="965297"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19plZWOyamzqKEi6CPWLclt"; posting-host="38a0272be55613828d7088b9a912db21" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:5/+k0mPONqgibYYr8vMzLB37+aU= sha256:4YphnJG2Fe07XbypwJvQyY1KMVz1hNkgEq1ySDOa43M= sha1:sDt59hkXkzHlYihQnYC4dnQGais= sha256:Oywg1e6goDqntymFIWVNssBftkWHqzcSPIzpX0OA0/4=