0

I'm trying to use the linux find command to show me the files in my current directory that have been modified in the last 24h. To test my command, I piped it to ls as below.

find . -maxdepth 1 -mtime -1 | xargs -I{} ls -lh {}

but this command displays all the files in my directory, some of which were modified last year. What am I missing here? I also tried -atime and -ctime options out of curiosity and got seemingly the same file list.

Many thanks for the advice!

1 Answers1

0

In my case the issues was caused because I had the wrong system time on my raspberry. This was because systemd-timesyncd.service was no longer running. After:

 sudo systemctl unmask systemd-timesyncd.service
 sudo systemctl enable systemd-timesyncd.service
 sudo reboot

the system time was correct again. Note that the pi needs to be connected to a network for this to work. And also, of course, past wrong file dates don't get fixed by this (duh).

user3817445
  • 455
  • 6
  • 5