Linux – How to find the oldest file in a directory tree

linuxshellunix

I'm looking for a shell one-liner to find the oldest file in a directory tree.

Best Answer

This works (updated to incorporate Daniel Andersson's suggestion):

find -type f -printf '%T+ %p\n' | sort | head -n 1