How to find all files modified in the last 1 day

When you are looking for some recently modified files, the `find` command is a great and very powerful tool.

In this short article we wil show you a few good examples of how you can make use of it.

Let’s start with finding files modified in the last 24 hours. The `mtime` parameter specifies the modification time in days, where 0 is within the last 24 hours:

find . -mtime 0

The “.” (dot) of course means the current working directory. You can type any path to be searched.

Using mtime with a plus sign in front of it, like +1 will mean more than one day before today or modified more than 48 hours ago:

find . -mtime +1

But sometimes you might want to search something more specific like file modified some minutes ago:

find / -mmin +15

With ‘mmin’ you can specify the modify time in minutes like in the example above where it looks for files modified at least 15 minutes ago.

So postitive values mean modified “more than” some time ago.

 

In both ‘mtime’ and ‘mmin’ you can also use negative times like:

find . mmin -60

It now means less that 60 minutes ago or files modified in the last 1 hour.

Last but not least you can use various combinations, for example:

find . -mmin +60 -mmin -120

Looking for all files in the current working directory, modified between 60 an 120 minutes ago.

 

Searching for files based on their modified time comes in hand in a lot of cases. From finding your recent work, to looking for eventually suspicious and unexpected changes in your file system.

 

Come back to CloudBalkan for more helpful topics on Linux, Servers and more.