by gbrown_ on 9/25/22, 9:54 AM with 14 comments
by unwind on 9/26/22, 6:56 AM
It's really fitting to have a supremely technical and focused tool like this be described with things like "pretty C expressions" and (my favorite) "it's like find(1), but more fun to use", because obviously writing low-level C-like expressions to match against files is fun, most of all. Love it.
Also some of the examples are truly powerful, and at least I was not aware of any tool that could do things like this:
# Find executable files that are larger than 10KiB, and have not been executed in the last 24 hours:
anyx && sz > 10K && atime < ago(day)
# Find regular files with multiple hard links
f && nlink > 1
# Find symlinks whose ultimate targets are on a different filesystem:
texists && tdev != dev
Examples all cherry-picked from the manual page, and I picked the most terse version, more readable/explanatory versions using fewer built-ins are also available.Many of the examples feel liks "I would never need that"-territory, until you do and then it's like impossible unless you write your own specialized tool to do it, or reach for this. Very cool!
by an1sotropy on 9/26/22, 6:37 AM
Authors: 1990 Ken Stauffer, 2022 raf <raf@raf.org>
Has this been around since 1990?I’m bummed I didn’t know about it. The variety of output options is amazing.
by rurban on 9/26/22, 7:58 AM
Ah, I see: https://github.com/raforg/rawhide/commits/main A bit more cleanup and handy aliases also.
by tyingq on 9/26/22, 11:58 AM
But, if you find yourself wanting something like this, and don't want to install anything new... Here's something close in Perl that uses File::stat (this ships with Perl):
find . -print | perl -MFile::stat -nE 'chomp;$s=stat($_);$s->nlink > 1 && say'