Bash Shell – How to Display the Last N Modified Files

bashlsshell

How can I list the 10 most recently modified files of a certain extension, not all files, or the files modified during the last 2 days for example?

Best Answer

You can use find for this. Let's say we want all .py files in the current directory modified in the last 2 days:

find -maxdepth 1 -name '*.py' -mtime -2