Find files that have changed in Linux

black and gray laptop computer
Photo by luis gomes on Pexels.com

I’ll confess, I stole this from somewhere on Stack Overflow and I’m posting it here just because it’s so flipping useful I know I will need it again some day.

find $1 -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head -n 20

Yes, this little bit of command-line voodoo will tell you all the files that have changed in the current directory (and its subdirectories) by putting them in datestamp order. It returns the top 20 by default, just change the 20 at the end to get a longer (or shorter) list.

Be the first to comment

Leave a Reply