[Slackbuilds-users] template find/chmod RFC
Jim
zsd+slackbuilds at jdvb.ca
Mon Aug 3 15:47:44 UTC 2026
On Mon, Aug 3, 2026 at 14:31 (+0200), Franzen via SlackBuilds-users wrote:
>> chmod -R u+w,go-w,a+rX-st .
> Here is an explanation why my proposal might not be that good. It's 13 years
> old, maybe chmod has changed to the better:
> https://unix.stackexchange.com/a/79874
Since I already timed the other replacement options, here is that one as
well (again, on qt6-6.8.3-x86_64-2_SBo.tgz, where find . | wc -l
outputs 18282, which is a lot of files and directories).
$ time find . ! -type l -a \( -perm /111 -a ! -perm 755 -a -exec chmod -f
755 {} + \) -o \( ! -perm /111 -a ! -perm 644 -a -exec chmod -f 644 {} + \)
0.03s user 0.06s system 99% cpu 0.086 total
$ time find . ! -type l -a \( -perm /111 -a -exec chmod -f 755 {} + \) -o
\( ! -perm /111 -a -exec chmod -f 644 {} + \)
0.07s user 0.22s system 99% cpu 0.285 total
$ time chmod -R u+w,go-w,a+rX-st .
0.03s user 0.21s system 99% cpu 0.244 total
Certainly the one with ! -perm is the fastest. Whether brevity is worth
two tenths of a second or not is probably a personal opinion.
Cheers.
Jim
More information about the SlackBuilds-users
mailing list