On 2022-09-13 01:06, John Stoffel wrote:
"Jaroslaw" == Jaroslaw Rafa raj@rafa.eu.org writes:
Dnia 12.09.2022 o godz. 12:30:29 John Stoffel pisze:
Sure, 'ls -l' doesn't do any sorting, it just reads the directory information as returned from the disk and show you the results. If you want it by time, you need to do:
ls -ltr
to have the newest files be at the end.
'ls' (and 'ls -l' as well) by default sorts files alphabetically. It has always been so.
Ooops, you're right! I was blanking on that since I was still thinking of the opendir() and readdir() calls which don't sort directory entries.
For unsorted list, one needs to use 'ls -lU' (that applies to GNU version of 'ls'; other versions may not recognize the '-U' switch).
Yup!
Also, ls -lt the other way round.