Linux: How to Find files modified in last few minutes or hours or days ?
Today we will see how to find the files which are modified recently on our linux system.
We will see the files modified in last few minutes, hour, and days.
I. Files modified in last 1 minute
[root@ngelinux ~]# find / -mmin -1 -type f -exec ls -l {} + | head -rw-rw-rw-. 1 root root 0 Apr 2 16:52 /proc/1/attr/current -rw-rw-rw-. 1 root root 0 Apr 2 16:52 /proc/1/attr/exec -rw-rw-rw-. 1 root root 0 Apr 2 16:52 /proc/1/attr/fscreate -rw-rw-rw-. 1 root root 0 Apr 2 16:52 /proc/1/attr/keycreate -r--r--r--. 1 root root 0 Apr 2 16:52 /proc/1/attr/prev -rw-rw-rw-. 1 root root 0 Apr 2 16:52 /proc/1/attr/sockcreate -rw-r--r--. 1 root root 0 Apr 2 16:52 /proc/1/autogroup -r--------. 1 root root 0 Apr 2 16:52 /proc/1/auxv -r--r--r--. 1 root root 0 Apr 2 16:52 /proc/1/cgroup --w-------. 1 root root 0 Apr 2 16:52 /proc/1/clear_refs find: 'ls' terminated by signal 13
II. Files modified in last 1 hour.
a. Modified Time [root@ngelinux ~]# find . -mmin -60 -type f -exec ls -l {} + | head -rw-r--r--. 1 root root 8 Apr 2 20:32 ./testfile b. File Change Time(any attribute of file if changes) [root@ngelinux ~]# find . -cmin -60 -type f -exec ls -l {} + | head -rw-r--r--. 1 root root 8 Apr 2 20:32 ./testfile c. Access Time [root@ngelinux ~]# find . -amin -60 -type f -exec ls -l {} + | head [root@ngelinux ~]# cat testfile hello A [root@ngelinux ~]# find . -amin -60 -type f -exec ls -l {} + | head -rw-r--r--. 1 root root 8 Apr 2 20:32 ./testfile [root@ngelinux ~]#
III. Files modified in last 10 days.
[root@ngelinux ~]# find . -mtime -10 -type f -exec ls -l {} + -rw-------. 1 root root 2978 Apr 1 19:55 ./.bash_history -rw-------. 1 root root 11 Apr 2 14:32 ./.cache/abrt/lastnotification -rw-------. 1 root root 5907 Apr 2 16:00 ./.viminfo -rw-------. 1 root root 106 Apr 1 14:53 ./.xauthHJcFZB -rw-------. 1 root root 106 Apr 2 14:24 ./.xauthaYQlR7 -rw-------. 1 root root 106 Apr 1 14:44 ./.xauthwEEOXH -rw-r--r--. 1 root root 24 Apr 2 16:10 ./testdir/Sample File.txt -rw-r--r--. 1 root root 8 Apr 2 20:32 ./testfile [root@ngelinux ~]#