How to find last modified file in Linux?
To find the last modified file in Linux, you can use the find
command with the -type f
option to search for regular files only, and then sort the results by modification time using the -printf
option.
find /path/to/directory -type f -printf '%TY-%Tm-%Td %TT %p
' | sort -r | head -n 1
This command will search for regular files in the specified directory and print out their modification time and filename in the format YYYY-MM-DD HH:MM:SS /path/to/file
, sorted by the modification time in reverse order (i.e., from newest to oldest). The head -n 1
command will then select the first (i.e., newest) file from the list.
- What Are The Benefits Of Using Natural Cleaning Products
- How Has Doctor Who Influenced Modern British Television
- Who Are The Top Football Clubs In Turkey
- How Do Farmers Manage Their Water Usage And Irrigation Needs
- What Is The Gulf Of Aqaba And Why Is It Significant
- How Did The Roman Empires Military Campaigns In Africa Shape The Regions History
- Is The Hisense H6510g Compatible With Apple Airplay
- How Did The Macedonian Seleucid Empire Trade With Other Cultures And What Did They Exchange
- Which Series Has Better Cinematic Adaptations Lord Of The Rings Or Game Of Thrones
- What Is The Nile Rivers Connection To The Sahara