Note: This will work for GNU-find, but not every other find.
find . -maxdepth 1 -size +20M -printf "%T@ %f\n" |
sort -nr | head -n 20 | sed 's/[^ ]\+ //'
Starting like @Rajish, but using the
printf command from
find to specify the output format. There are 3 time-related formats, atime, ctime and mtime -
%T is for mtime,
%C are for the other formats.
@ is to specify the timeformat in seconds since epoch.
%f is for the filename,
\n for a newline between 2 files.
Then sorting by number in reversed order gives the youngest files first, and we take 20 lines¹ with
In the end,
sed is used, to throw away the time information.
head works line by line, a single file with more than 20 newlines in the name, which is a bit unusual, but not prohibited, can corrupt the output if it is belong the first 20 matches. If you happen to have such files, please try to get rid of them - well, to change their name. They will often be a problem for simple scripts.