Linux ‘find’ command error: missing argument to -exec

Problem: I just issued a Linux find command, and got the following error message:

find: missing argument to -exec

Solution: Amazingly, it turns out that the computer is right, and I messed up my command. I entered my find command like this:

find . -type f -exec grep -il mail

That’s the way I want to type my find command, but the correct way to type it is to add the extra characters at the end of the command, like this:

find . -type f -exec grep -il mail {} \;

Once I added those {} \; characters at the end of my find command, the find error message went away.

(If you’ve never seen the Linux find and grep commands used like this before, I describe them in more detail on my grep command and find command example pages.)