Harness the Combinatoric Power of Command-Line Tools and Utilities
Find Modified Files
Published May 17, 2024 and last verified on December 13, 2025
Warning
❗ This article is more than six months old. Some things may not work as written.
In the current directory, you can see the most recently modified files with the ls -ltr command, which sorts the listing with the most recently changed directories and files last.
To search a directory and its children for the most recently changed files, use the find command and send the results to the sort command:
find ~/Documents -type f -printf "%T@ %T+ %p\n" | sort -nHere’s how it works:
find ~/Documents -type f: This part of the command searches for all files (-type f) within the~/Documentsdirectory.-printf "%T@ %T+ %p\n": This specifies the output format for each file found:%T@prints the modification time as a numeric timestamp, which will be whatsortuses to sort the results.%T+prints the modification time in a human-readable format.%pprints the file path.\nensures that each file’s information is printed on a new line.
| sort -n: This pipes the output of thefindcommand tosort, which sorts the lines numerically (-n), based on the timestamp printed by%T@.
The most recent files are at the end of the list.