How do I list all the files in a directory and subdirectories in reverse chronological order?
ls -lR
is to display all files, directories and sub directories of the current directory
ls -lR | more
is used to show all the files in a flow.
Try this one:
find . -type f -printf "%T@ %p\n" | sort -nr | cut -d\ -f2-
If the number of files you want to view fits within the maximum argument limit you can use globbing to get what you want, with recursion if you have globstar support.
For exactly 2 layers deep use: ls -d * */*
With globstar, for recursion use: ls -d **/*
The -d
argument to ls
tells it not to recurse directories passed as arguments (since you are using the shell globbing to do the recursion). This prevents ls
using its recursion formatting.