Categories
linux

How to find Files that are Modified today in Unix / Linux

To find all files that was modified since a specific time ago (i.e an hour ago, a day ago, 24 hours ago, a weeks ago, a month ago and so on) in Unix and Linux environment, the find command will come in handy. The command syntax is:

To find all files modified in the last 24 hours (last full day) in current directory and its sub-directories:

find . -mtime -1 -print

Flag -mtime -1 option tells find command to look for files modified in the last day (24 hours). Flag -print option will cause find command to print the files’ location. -print can be replaced with -ls if you want a directory-listing-type response.

To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories:

find /directory_path -mtime -1 -print

The command is basically the same with the earlier command, just that now you no need to cd (change directory) to the directory you want to search.

To find all files with regular file types only, and modified in the last 24 hours (last full day) in current directory and its sub-directories:

find /directory_path -type f -mtime -1 -print

Find files Modified 4 days ago on linux

To find all files that are modified today only (since start of day only, i.e. 12 am), in current directory and its sub-directories:

touch -t `date +%m%d0000` /tmp/$$
find /tmefndr/oravl01 -type f -newer /tmp/$$
rm /tmp/$$

The first command can be modified to specify other date and time, so that the commands will return all files that have changed since that particular date and time.

'Coz sharing is caring

By Swatantra Kumar

Swatantra is an engineering leader with a successful record in building, nurturing, managing, and leading a multi-disciplinary, diverse, and distributed team of engineers and managers developing and delivering solutions. Professionally, he oversees solution design-development-delivery, cloud transition, IT strategies, technical and organizational leadership, TOM, IT governance, digital transformation, Innovation, stakeholder management, management consulting, and technology vision & strategy. When he's not working, he enjoys reading about and working with new technologies, and trying to get his friends to make the move to new web trends. He has written, co-written, and published many articles in international journals, on various domains/topics including Open Source, Networks, Low-Code, Mobile Technologies, and Business Intelligence. He made a proposal for an information management system at the University level during his graduation days.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.