When working on the Linux command line, you'll often need a quick reminder of how a command works or what options it accepts. Fortunately, Linux provides excellent tools for command line help right in the terminal.
The 'help' Command for Bash Built-ins
One of the most direct tools is help, a command that is built directly into the Bash shell. It is specifically designed to provide information about other Bash built-in commands. A built-in command is part of the shell itself, not a separate program. Examples include echo, cd, and pwd.
To use the Linux help command, simply type help followed by the name of the built-in command.
help echo
This will display a summary of the echo command, its syntax, and a list of available options. This is the fastest way to get assistance for shell-specific functions.
The --help Flag for Executable Programs
For most other executable programs that are not built into the shell, the help command won't work. Instead, a common convention is to provide a --help flag. This option signals the program to print a usage summary and then exit.
ls --help
While most developers adhere to this standard, it's not universal. However, trying the --help flag is usually the best first step to find help for an unfamiliar program. It's a fundamental skill for anyone learning about Linux commands.