Categories
Linux Server Administration Tips

Linux: Find files changed or modified within xx day or older than xx day

One of the utility commands of Linux that you should know in the first day of your Linux learning seminar is find.

To search recursively in the directory somedir for files changed / created / modified within 1 day:

find somedir -ctime -1

Or within 5 days:

find somedir -ctime -5

To search recursively in the directory somedir for files changed changed / created / modified more than 1 days ago:

find somedir -ctime +1

Or more than 5 days ago:

find somedir -ctime +5

To search recursively in the directory somedir for files modified within 1 day:

find somedir -mtime -1

To search recursively in the directory somedir for files modified more than 1 days ago:

find somedir -mtime +1

Or more than 2 weeks ago:

find somedir -mtime +14

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.

2 replies on “Linux: Find files changed or modified within xx day or older than xx day”

Using this, I will try to find which images have been uploaded recently(within 7 days), by my users. And may be their size also.

find /public_html/upload/ -regex “\.gif|\.png|\.jpg|\.jpeg” -mtime -7

Reviews welcome.

Comments are closed.