LinuxCommandLibrary

help

Display command usage information

TLDR

Display the full list of builtin commands

$ help
copy

Print instructions on how to use the while loop construct
$ help while
copy

Print instructions on how to use the for loop construct
$ help for
copy

Print instructions on how to use [[ ]] for conditional commands
$ help [[ ]]
copy

Print instruction on how to use (( )) to evaluate arithmetic expressions
$ help \( \)
copy

Print instructions on how to use the cd command
$ help cd
copy

SYNOPSIS

help [-dms] [pattern ...]
help -t

PARAMETERS

-d
    Display a short description for each pattern.

-m
    Display the information in a format similar to a manual page.

-s
    Display only a short synopsis for each pattern.

-t
    Display a list of all built-in commands for which help topics are available.

DESCRIPTION

The help command is a Bash shell built-in used to display information about other built-in commands. Unlike external utilities like man or info, which search for system-wide manual pages or info documents, help provides quick, concise documentation directly from the shell's internal data. This makes it particularly useful for understanding the syntax, options, and usage of commands that are integral parts of the Bash shell itself, such as cd, echo, for, if, or read. It's a convenient way for users to quickly look up command specifics without leaving the terminal or consulting external resources, streamlining the learning and debugging process within the shell environment.

CAVEATS

help is a Bash built-in command, not an executable program found in the system's PATH. This means it only provides documentation for other Bash built-ins and not for external executables (like ls or grep). For external commands, users should consult man pages or info documents. Its availability and exact behavior are specific to Bash and may differ in other shells.

SOURCE OF DOCUMENTATION

The information displayed by help is hardcoded or embedded directly within the Bash executable itself. This allows for very fast retrieval without disk I/O, contrasting with man which reads files from specific directories.

HISTORY

The help command was developed as an integral part of the GNU Bash shell to provide users with immediate, context-sensitive documentation for its internal commands. Its design reflects the need for quick reference within the interactive shell environment, eliminating the overhead of external process calls to retrieve man pages. This functionality has been a staple of Bash for many years, evolving alongside the shell to ensure that built-in commands are well-documented and easily discoverable by users directly at the command line.

SEE ALSO

man(1), info(1), type(1), bash(1)

Copied to clipboard