Linux help Command: Read Help for Bash Built-in Commands
help is a built-in command that allows you to check the usage of built-in commands and shell syntax provided by Bash. Functions that are part of the shell itself, such as cd, read, alias, and for, are faster and more accurate to check with help than with man.
The most basic usage is help item. You can either look at a simple syntax, create a short list of descriptions, or display it in a format similar to a manual page.
What is the help command?
A Bash built-in command (builtin) is a function that runs directly within the shell process. Commands closely related to the shell state, such as cd which changes the current shell working directory, read which reads shell variables, and alias which manages aliases, are typical examples.
help provides assistance not only for these Bash built-in commands but also for shell syntax items like if, for, while, and [[. In shells other than Bash, the existence of commands and the output format may differ.
Basic syntax and usage examples
help [-dms] [pattern]
When run without arguments, it outputs a list of built-in commands and syntax items for which Bash provides help.
help
To view detailed help for a specific command, specify its name.
help cd help read help printf
You can check shell syntax in the same way. It is safe to enclose some symbols in quotes because the shell might interpret them first.
help if help for help '[['
help option
| Option | Description |
|---|---|
-d |
Only outputs a brief description of each item. |
-m |
Displays help in a format similar to a manual page. |
-s |
Only outputs a simple usage format (synopsis) of the command. |
When writing scripts and quickly checking argument placement, -s is useful.
help -s read help -s getopts
Use -d if you need a simple list of descriptions, and -m if you need detailed explanations separated into paragraphs.
help -d cd help -m cd
Finding multiple help topics with a pattern
Searching by prefix
If there is no exact match, Bash searches for help topics that match the entered pattern and prefix. For example, the following command can show items starting with comp, such as compgen, complete, and compopt.
help comp
Using wildcard patterns
If the pattern contains shell pattern characters, all matching help topics are displayed. Enclose the pattern in quotes to prevent it from being expanded to file names in the current directory first.
help 'read*' help '*dir*'
You can also search the entire list with grep, but using the pattern feature of help first allows you to obtain results based on the names of help topics.
Using help after confirming it is a built-in command
If you are unsure about the type of command, check with type. If the result is shell builtin, help often provides the most direct explanation.
type cd type printf type ls
Both Bash built-in commands and external executable files can exist, like printf. To check all possible targets that may actually run, you can execute the following.
type -a printf
help printf explains the Bash built-in printf. If you want to know the behavior of an external program, you need to check the --help or manual of that executable.
Differences between help, --help, and man
| Method | Suitable target | Features |
|---|---|---|
help item |
Bash built-in commands and shell syntax | Explanations provided directly by the current Bash |
command --help |
External programs and some built-in commands | Quickly check short syntax and options |
man command |
Commands, file formats, system calls, etc. | Check the installed manual page in detail |
info command |
GNU programs that provide Info documents | Navigate long documentation with nodes and index |
`cd --help` can display the help for the `cd` built-in command in Bash, but you should not expect the same method to work for all shells or all built-in commands. It is clearer to check Bash built-in commands based on `help`.
Practical Usage Examples
Checking Various Options of `read`
`read` has many options such as input, timeout, delimiters, and arrays. First, check the usage format, then find the necessary options in the detailed description.
help -s read help read
Checking Syntax for Conditional and Loop Statements
Reserved words and compound commands in shell scripts can also be help topics.
help if help while help for help case
Sending Output to a Pipe or File
The output of `help` goes to standard output, so it can be read with a pager or saved to a file.
help -m read | less help -m read > read-help.txt
The explanation saved to a file is based on the Bash version's help at that time, so check the Bash version of your environment before applying it to another system as is.
Checking help results in a shell script
If the requested help topic exists, it generally returns an exit status of 0, and if no matching topic exists, it returns a non-zero value. You can use this to check whether a specific help item exists.
if help mapfile >/dev/null 2>&1; then printf '%s\n' 'You can use mapfile help.' else printf '%s\n' 'Could not find mapfile help in the current shell.' fi
However, if the purpose is to check for feature support, it is more reliable to use type, command -v, or perform an actual feature test rather than parsing the help output. This is because the help text can vary depending on translation and Bash version.
Frequently Asked Questions
help: no help topics match error occurs
The name you entered is either not a Bash help topic or is not provided in the current Bash version. Check the command type with type name, and if it is an external program, use command --help or man command.
help does not work in sh scripts
help is a Bash built-in command. If /bin/sh points to a shell other than Bash or if Bash is running in POSIX mode, you may not get the expected results. If your script uses Bash features, you should clearly specify the interpreter and execution environment.
It is the same command, but the explanations in help and man are different.
Built-in commands and external programs can have the same name. You can check the candidates with type -a name; for Bash built-in commands, use help, and for external executable files, read the program's manual.
Do I need to install help separately?
No. help is a Bash built-in command, so it is included in Bash. If the current shell is not Bash, the same command may not exist or its functionality may differ.
Can I search all Linux commands with help?
No. The main target of help is Bash built-in commands and shell syntax. For external commands, use --help, man, info, or the official documentation.
Which option should I use to see just a simple one-line syntax?
Use help -s item. If you need a short description as well, use -d, and if you need a manual-like format, use -m.
Summary
help is the most direct tool to check Bash built-in commands and shell syntax. You can read detailed explanations with help item, check only the syntax with -s, and use patterns to find related items together.
If you are not sure about the type of command, check it first with type. Use --help and man for external programs, and other basic commands can be found in the list and overview of Linux commands.









