Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find files modified over 1 hour ago but less than 3 days

Tags:

linux

bash

In linux, using bash, what's the easiest way to find files that were modified more than an hour ago but less than 3 days ago?

Surely, there's got to be an easy way to do this. I keep searching and can't find an easy solution.

like image 423
newUserNameHere Avatar asked Oct 03 '15 12:10

newUserNameHere


People also ask

How do you find all the files modified in less than 3 days and save the record in a text file?

Use -mtime option with the find command to search files based on modification time followed by the number of days. Number of days can be used in two formats.

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

Example 1: Find files whose content got updated within last 1 hour. To find the files based up on the content modification time, the option -mmin, and -mtime is used.


2 Answers

Find has -mtime and -mmin:

find . -mtime +3 -mmin -60

From the find manual:

Numeric arguments can be specified as:

+n for greater than n

-n for less than n

n for exactly n

like image 197
borancar Avatar answered Nov 15 '22 17:11

borancar


This should suffice: find . -mtime -3 -mmin +60

I just tried it:

find ./ -mtime -3 -mmin +60 -exec ls -lhrt {} \; | awk '{print $5" "$6" "$7" "$8}'

like image 24
TheodoreC Avatar answered Nov 15 '22 15:11

TheodoreC