false
Linux · Terminal · reference only
What it does
Does nothing and always exits with status 1, which means failure. It is used to test scripts and conditions.
Syntax
false
Options and parameters
(sin argumentos)Always returns exit status 1.
--helpShows help (only in the external /usr/bin/false version).
--versionShows the version (only in the external /usr/bin/false version).
Usage examples
false; echo $?Prints 1, false's exit status.
false || echo "falló"Since false fails, the second command runs.
if false; then echo si; else echo no; fiPrints no because the condition is false.
getent passwd servicio | cut -d: -f7A service account usually has /usr/sbin/nologin or /bin/false as its shell to block interactive access.
Notes and common mistakes
- Its opposite is true, which always returns 0.
- Using it as an account's shell prevents logging in with it.