I know that I can sort the output of ls by time with the -t option.
I know that when I have so many files that they don't fit in a single ls invocation, I can normally use xargs (or find ... -exec ... {} +) to let ls be called multiple times.
How can I combine the two? I have more files than fit on the command-line, and wish to list them sorted by time. find . -type f -exec ls -t {} + doesn't work, because supposing exactly 1000 file names fit on the command-line, and 3000 files are present, this will run ls -t [first 1000 files]; ls -t [second 1000 files]; ls -t [last 1000 files], where the last 1000 files find sees may well have a modification time before any of the first 1000. It doesn't seem like anything involving xargs or equivalent has any chance whatsoever of working, it seems like that approach is fundamentally flawed, but I cannot find a way that does work.
-printfwas this powerful. According to the documentation,%A@is the access time. I'm looking for the mtime, so I'd need%T@. – hvd Aug 11 '14 at 07:43sed -z 's/^[^ ]* //'ortr '\0\n' '\n\0' | cut -d ' ' -f2- | tr '\0\n' '\n\0'– Stéphane Chazelas Aug 12 '14 at 08:38