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 Challenges Of Living In The Sahara
- What Is The Karnak Open Air Museum And Why Is It Significant
- What Are The Similarities Between Saturn And The Other Gas Giants
- Who Are The Top Football Clubs In Turkey
- What Are The Benefits Of Using Natural Cleaning Products
- What Are Some Of The Best Shopping Areas In New York City
- What Are Popular New Zealand Drinks In Auckland
- Who Holds The Most Guinness World Records And What Are Some Of Their Achievements
- Where Is The Sahara Located
- Why Do Some Movies Win So Many Awards But Others Dont Get Any Recognition