How to fix “find: missing argument to -exec” error

The error “find: missing argument to -exec” can often occur when running bash commands on the Linux terminal. The command “-exec” is an inbuilt command which is used in Ubuntu to execute another command directly from bash. It will not generate any new commands. Instead, it will simply replace bash with the exec command.

While using the exec command, you would have encountered the missing argument error. In our today’s guide, we will provide a set of reasons that invokes the “argument missing” error and also the possible solutions to that error.

How to fix the “find: missing argument to exec” error?

There can be multiple reasons for this error, but we will go through the most common ones that cause the “find: missing argument to -exec” error. This list of those reasons is stated below:

Reason: Incorrect Syntax

Syntax is an important part of any command. This is no different for the find command as the most common reason for the occurrence of this error is the use of an incorrect syntax as demonstrated below:

Solution: Use Correct Syntax

how to handle linux files and direc...

The first reason for this error relates to the syntax. As a reference, we have provided the possible syntaxes of the -exec command to help resolve the error.

The standard syntax for an exec command is as follows:

-exec <command> {} +

The components of syntax are described as:

  • The “-exec” is a keyword.
  • The “<command>” represents any command that will be executed using the “-exec” keyword.
  • The {}\; characters at the end of the command

Another standard syntax for “exec” is written as follows includes the {}\; characters which is often the most common reason that your system prompts the error. Simply add these characters at the end of your command as demonstrated:

-exec command {}\;

In this case, we use “\;” instead of “+” to terminate the “exec” command.

Reason 2: Multiple Commands with One exec

Apart from the above-mentioned reason, this error is also invoked by using the same “-exec” command to execute multiple commands.

Solution 2: Use Separate exec Commands

The best way to resolve this make sure that if there are multiple executable commands, then a separate exec keyword is being used for each of those commands. The sample command below demonstrates how two separate commands are being executed with two separate exec keywords:

find . -type f -name "*.rm" -exec ffmpeg -i {} -sameq {}.mp3 \; -exec rm {} \;


There are two reasons that cause the missing argument error while using the exec command. To avoid these errors, you need to use the correct syntax and multiple exec commands (where multiple operations are being performed). This post has demonstrated the reasons for the missing argument error and also stated the possible solutions to these errors.