false

Linux · Terminal · available in the simulator

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.

  • --help

    Shows help (only in the external /usr/bin/false version).

  • --version

    Shows 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; fi

    Prints no because the condition is false.

  • getent passwd servicio | cut -d: -f7

    A 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.
Practise false

Related commands