false command in Linux with examples

false command is used to return an exit status code (“1” by default) that indicates failure. It is useful when the user wants a conditional expression or an argument to always be unsuccessful. When no argument is passed to the false command, it fails with no output and exit status as 1.


false [argument]


We can see that no output is returned but we can check the exit status value by checking the value of the special shell variable i.e. ?, that contain the exit status of the false command. Since ? is a variable, we need to prefix it with $ for the reference.



Example: To print the exit status of the previous command.


  • –help : It is used to show this help information and exit.
  • –version: It gives the version information and exit.

Implementing false command in an if statement: We can use the false command in if statement when we want to execute a statement/command if the condition becomes false.


if false; then [Executable statements]; else [Executable statement]; fi


if false; then echo "It's false"; else echo "It's True"; fi

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.