How to sort results from ls command by modification date (directories first)?
what about something like this:
ls -ltr --group-directories-first
ls -t
or (for reverse, most recent at bottom):
ls -tr
The ls
man page describes this in more details, and lists other options.
Directories have d
in front of there permissions in ls -ltr
So to get directories with sorted modification date use
ls -ltr |grep ^d
And to files other than directories
ls -ltr | grep -v ^d