On Thu, Aug 14, 2025 at 12:15:25PM +0200, Rocky Hotas wrote: > Hello! > I'm trying to use find(1) in a POSIX way to list all the files (not > directories) with at least one execute bit set. In other words, all > the following modes should cause a match: > > -rwxr-xr-x 1 myuser wheel 6 Aug 14 11:46 file1 > -rwxr--r-- 1 myuser wheel 7 Aug 14 11:46 file2 > -rw-r-xr-- 1 myuser wheel 4 Aug 14 11:52 file3 > -rw-r--r-x 1 myuser wheel 6 Aug 14 11:53 file4 > -rwxr-xr-- 1 myuser wheel 6 Aug 14 12:10 file5 > > (also `rwxr--r-x' should match, and so on). > > The only way I found so far is the following: > > find /target_directory/ -type f -perm -001 -or -type f -perm -010 -or -type f > -perm -100 > > It seems to work, but it's somewhat cumbersome. In GNU find, there is a > single dedicated option, `-executable'. > Is there a more compact, but still POSIX, way to obtain the same > result with NetBSD's find(1)?
Minor simplification: find /target_directory/ -type f -and \( -perm -001 -or -perm -010 -or -perm -100 \) I can't see any other options. -- Paul Ripke "Great minds discuss ideas, average minds discuss events, small minds discuss people." -- Disputed: Often attributed to Eleanor Roosevelt. 1948.