Discovered: Nov 3, 2025 18:37 (UTC) ME:: find is often easier to use with shell pattern matching instead of regular expressions! ; How to randomly open a jpeg or JPG or JPEG or jpg file ; explainshell.com - find . -type f ( -iname “.jpg” -o -iname “.jpeg” ) ¦ sort -R ¦ head -1 ¦ xargs -n 1 open

Key Details

Like -name, but the match is case insensitive. For example, the patterns fo*' and F??’ match the file names Foo', FOO’, foo', fOo’, etc. In these patterns, unlike filename expansion by the shell, an initial ‘.’ can be matched by *'. That is, find -name *bar will match the file .foobar’. Please note that you should quote patterns as a matter of course, otherwise the shell will expand any wildcard characters in them.

  • within a shell pattern, -o means OR, -a means AND

Leave a comment on github