Is there a standard dummy executable file that does nothing in Linux?

There's the standard utilities true and false. The first does nothing but return an exit status of 0 for successful execution, the second does nothing but return a non-zero value indicating a non-successful result(*). You probably want the first one.

Though some systems that really want you to enter some text (commit messages, etc.) will check if the "edited" file was actually modified, and just running true wouldn't fly in that case. Instead, touch might work; it updates the timestamps of any files it gets as arguments.

However, if the editor gets any other arguments than the filename touch would create those as files. Many editors support an argument like +NNN to tell the initial line to put the cursor in, and so the editor may be called as $EDITOR +123 filename.txt. (E.g. less does this, git doesn't seem to.)


Note that you'll want to use true, not e.g. /bin/true. First, if there's a shell involved, specifying the command without a path will allow the shell to use a builtin implementation, and if a shell is not used, the binary file will be found in PATH anyway. Second, not all systems have /bin/true; e.g. on macOS, it's /usr/bin/true. (Thanks @jpaugh.)

(* or as the GNU man page puts it, false "[does] nothing, unsuccessfully". Thanks @8bittree.)


In the shell, you can use the built-in :. It's not an executable file, but in a shell script or anything executed from a shell script it will do:

$ help :
:: :
    Null command.
     
    No effect; the command does nothing.
     
    Exit Status:
    Always succeeds.

This is perhaps best known for use in a while statement (while :; do break; done), but is not limited to such use. In case you need to do this many times, it's much faster to not start a separate process:

$ time for i in $(seq 1000); do :; done

real    0m0,007s
user    0m0,002s
sys     0m0,004s
$ time for i in $(seq 1000); do /bin/true; done

real    0m0,686s
user    0m0,462s
sys     0m0,217s

@ilkkachu's suggestion of using the true command is probably the best answer, but you could also use the command

sleep 0