5/25/2013

Linux: Find files that have been Changed, Modified or Accessed recently? List from last minutes or days?

The command to locate and list files that have been modified, changed or accessed recently is "find".

"Find" can be used in combination with tests that begin with "a", "c" or "m" for Access, Change or Modify.
And either "min" for minutes or "time" for days.

Ex.
To find any files that have been changed in the last two days
find . -ctime -2 
To find any .php files that have been modified in the last 2 hours:
find *.php -mmin -120
To find any files that have been accessed in the past 3 days, but not including today: 
find . -atime +0 -a -atime -3
The minus (-) before the number value means "within the past number of days / minutes."
The plus (+) before the number value means  "before the past number of days / minutes."
The last example joins two commands, to mean "any time before today, and within the last 3 days."

You'll probably want to pipe long lists of results to a "more" command.

Ex.
find . -ctime -2 | more

No comments :

Post a Comment