Session and utilities
The true command
Does nothing and exits successfully (code 0). Its use is in scripts, for infinite loops or default values.
Syntax
trueCopy-ready examples
$ true && echo okExits wellYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- It prints nothing: it is only useful for its exit code.
FAQ
Why would I want a command that does nothing?
In scripts, for example for a 'while true' loop or to ignore an error.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course