How to list the ten most recent files in the same directory
Jump to navigation
Jump to search
How can I list the ten most recent files in a directory using the command line?
Windows[edit]
If you know the path to your target directory on Win , use:
dir path\to\working_folder /O-D
For paginated viewing:
dir path\to\working_folder /O-D | more
If you're already in the working folder:
dir . /O-D dir . /O-D | more
Linux[edit]
If you know the path to your target directory on Linux or Mac
, use:
ls -lht /path/to/working_folder | head -10
If you're already in the working folder:
ls -lht . | head -10 ls -lht | head -10