Search and Compress Files by Modification Date

Maciej
1 min readAug 31, 2022
Photo by Markus Winkler on Unsplash

Introduction

Useful list of example for search and compress files by modification date.

Search by date

Find files updated in the last 24 hours

[root@localhost tmp]# find -type f -mtime 0

Find files updated today

[root@localhost tmp]# find -type f -newermt `date +%F`

Find files updated in the last 48 hours

[root@localhost tmp]# find -type f -mtime -2

Find files modified by yesterday

[root@localhost tmp]# find -type f -newermt `date +%F -d yesterday`

Find files updated in the last 72 hours

[root@localhost tmp]# find -type f -mtime -3

Search for files modified up to 3 days ago

[root@localhost tmp]# find -type f -newermt `date +%F -d -3days`

Find files modified after July 1, 2022

[root@localhost tmp]# find -type f -newermt 2022-07-01

Search by time

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.