Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
525 views
in Technique[技术] by (71.8m points)

linux - Find out if file has been modified within the last 2 minutes

In a bash script I want to check if a file has been changed within the last 2 minutes.

I already found out that I can access the date of the last modification with stat file.ext -c %y. How can I check if this date is older than two minutes?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think this would be helpful,

find . -mmin -2 -type f -print

also,

find / -fstype local -mmin -2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...