Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the files that have been changed in last 24 hours

Tags:

linux

find

bash

E.g., a MySQL server is running on my Ubuntu machine. Some data has been changed during the last 24 hours.

What (Linux) scripts can find the files that have been changed during the last 24 hours?

Please list the file names, file sizes, and modified time.

like image 978
JackWM Avatar asked Apr 18 '13 14:04

JackWM


People also ask

How do I find recently changed files?

File Explorer has a convenient way to search recently modified files built right into the “Search” tab on the Ribbon. Switch to the “Search” tab, click the “Date Modified” button, and then select a range. If you don't see the “Search” tab, click once in the search box and it should appear.

Which command to find all the files which are changed in last 1 hour?

Thus find -ctime 0 finds everything for which the inode has changed (e.g. includes file creation, but also counts link count and permissions and filesize change) less than an hour ago.

How do I find changed files in Linux?

Finding Files Modified on a Specific Date in Linux: You can use the ls command to list files including their modification date by adding the -lt flag as shown in the example below. The flag -l is used to format the output as a log. The flag -t is used to list last modified files, newer first.


2 Answers

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 -ls 

Should be to your liking

The - before 1 is important - it means anything changed one day or less ago. A + before 1 would instead mean anything changed at least one day ago, while having nothing before the 1 would have meant it was changed exacted one day ago, no more, no less.

like image 100
Xavjer Avatar answered Sep 30 '22 02:09

Xavjer


Another, more humane way:

find /<directory> -newermt "-24 hours" -ls 

or:

find /<directory> -newermt "1 day ago" -ls 

or:

find /<directory> -newermt "yesterday" -ls 
like image 24
Maxim Egorushkin Avatar answered Sep 30 '22 01:09

Maxim Egorushkin