On a Linux system, what is /bin/true
? What is it used for?
/bin/true is a command that returns 0 (a truth value in the shell). Its purpose is to use in places in a shell script where you would normally use a literal such as "true" in a programming language, but where the shell will only take a command to run.
If we look at the two commands' man pages, the descriptions are pretty simple: /bin/true – “do nothing, successfully” /bin/false – “do nothing, unsuccessfully”
On Unix-like operating systems, the true command's sole purpose is to return a successful exit status. It is useful when you want part of a command or conditional expression always to be true.
/bin/bash is the most common shell used as default shell for user login of the linux system. The shell's name is an acronym for Bourne-again shell. Bash can execute the vast majority of scripts and thus is widely used because it has more features, is well developed and better syntax.
/bin/true
is a command that returns 0 (a truth value in the shell).
Its purpose is to use in places in a shell script where you would normally use a literal such as "true" in a programming language, but where the shell will only take a command to run.
/bin/false
is the opposite that returns non-zero (a false value in the shell).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With