FreeKB - Linux Commands find command - date modified (-mtime)
Linux Commands - find command - date modified (-mtime)

The -mtime option can be used to return files and directories that were modified x or more days ago. For example, to return files and directories that were modified 14 or more days ago below the tmp directory.

find /tmp -mtime +14

 

  • The -atime option can be used to return files and directories that were accessed x or more days ago.
  • The -ctime option can be used to return files and directories that were changed x or more days ago.

 

To include the date and time the file was last modified in the output.

  • %y = time last modified
  • %n = file name
find /tmp -exec stat --format  "%y %n" "{}" \;

 

This will return something like this.

2020-07-06 05:50:18.594805437 -0500 /tmp/foo.txt
2020-07-06 02:10:38.898884577 -0500 /tmp/bar.txt

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 9eaa6 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |