How to use multiple criteria for the `find` command
The command you are looking for is:
find . -type f \( -name '*.jpg' -or -name '*.png' \) -not -name "cover.*"
Adding
type -f
will make thefind
command look only for files.In your second command, you need to add a space after
\(
and before\)
(you also forgot\
before(
).Also, you don't need a
-
between-not
and-name
. Your first command works fine if you remove it, although not producing the output that you want (see JoL's comment).
You can read more about find
's syntax and options at the command's online Ubuntu manpage, or run the command man find
to read the manual in the terminal. Specifically, read the OPERATORS
section of the manual, since that's what appears to be confusing you the most.
Note: Most terminal commands provide a manual with the proper command syntax and available options which you can read if you run man <command>
in your terminal.