Sorting a *nix folder by last modification date
SoftwareIn my continuing series of things you already know, unless you don’t, this command sorts the contents of a folder by modification date, then lexicographical:
$ ls -lrt
Nine times out of ten, when I’m browing a folder of logs or assets or anything else, I’m looking at what was last changed. This puts the most recent changes at the bottom, which is useful if the list is longer than my console.
I’ve long since committed this to muscle memory, like a gentleman, but at the time I remembered it by thinking of the Singaporean and Malaysian trains. You may substitute it with your own mnemonic.
You won’t want to use this in a script, but it’s still super useful. Like a banana. And the man pages for FreeBSD, NetBSD, macOS, and GNU/Linux will have more details.