Feature #13555


Offer common aliases for operators `-a`, `-o`, and `!` in find(1)

Added by Michael Siegel 3 months ago. Updated 3 months ago.

cmd - userland programs
Start date:
Due date:
% Done:


Estimated time:
find operator alias
Gerrit CR:


Currently, illumos find(1) does not support `-not` as an alias to the `!` operator. And it doesn't support the long forms `-and` and `-or` for `-a` and `-o`, respectively, either.

Busybox, GNU, FreeBSD, NetBSD, and OpenBSD all offer those in their versions of find(1). So, it would be quite nice to have them on illumos as well.

Also, `-and`, `-or`, and `-not` are both less cryptic and more consistent than `-a`, `-o`, and `!`.

Actions #1

Updated by Robert Mustacchi 3 months ago

I'm taking a look at the source and it does seem like we have all three of these present in cmd/find/find.c:

rm@beowulf:/var/tmp$ which find
rm@beowulf:/var/tmp$ find . -type f -o -type d
rm@beowulf:/var/tmp$ find . -type f -or -type d
rm@beowulf:/var/tmp$ ls -ltrs
total 49
  31 -rw-r--r--   1 rm       other     159803 Dec  7 09:35 topo.out
   1 -rw-------   1 rm       other    104857600 Jan 16 10:12 blahdisk
   1 -rw------T   1 root     root     104857600 Jan 16 11:20 blahdisk-nl
  16 -rw-r--r--   1 root     root       90140 Jan 16 11:21 diskinfo.out
rm@beowulf:/var/tmp$ find . -type f -not -user root
rm@beowulf:/var/tmp$ find . -type f -not -user root

So at least this is all working or me with illumos. It is missing from the manual page. Is there a particular distribution that you're using or an example where this isn't working for you?

Actions #2

Updated by Robert Mustacchi 3 months ago

  • Assignee set to Robert Mustacchi
Actions #3

Updated by Michael Siegel 3 months ago

I was solely going by what the documentation says. I don't have an illumos system around for testing, currently.

So, adding these things to the manual page is apparently all that needs to be done.

Apropos: The find manual page should also have a section mentioning which of the options, primaries, and operators are extensions to POSIX. OpenBSD does that quite nicely:


Also available in: Atom PDF