In Linux and Unix-like systems, you often encounter two primary mechanisms for
accessing command documentation right from the terminal: the
help command and
--help option. While both serve a similar purpose—providing help and
information about commands—they operate in distinct ways and cater to different
types of commands. This article aims to dissect the differences between these
two, helping you understand when and how to use each.
--help option is a common feature for many executable programs and
external commands in Linux. This option displays a help message with a brief
overview of the command's functionality, its syntax, and options.
For instance, if you want to know how to use the
ls command and its options,
you would type:
This will produce a help message that describes what the
ls command does,
along with a list of options and their descriptions. Unlike
option is usually more concise and may not offer as detailed explanations as man
pages or other sources of documentation.
help [option] pattern
|Detailed for built-ins, can offer examples
|Usually concise, option-specific
|Offers pattern matching, can list all built-ins
|Fixed output, no customization
|Built into the shell, always available for built-ins
|Available if implemented by the command
help -d "c*"
When to Use Which?
helpwhen dealing with shell built-ins: If you need comprehensive information about commands like
read, etc., which are built into the shell,
helpis your best bet.
--helpfor external commands: For external programs and utilities like
wget, use the
--helpoption for a quick rundown of available options and basic usage.
--help serve similar end goals, the two are far from
help command is specialized for providing detailed
information on shell built-in commands, while the
--help option is designed to
provide a quick overview of external commands and programs. Knowing the
differences between the two will enable you to more effectively seek out
command-line assistance, enriching your Linux command-line experience.
What Can You DO Next 🙏😊
If you liked the article, consider subscribing to Cloudaffle, my YouTube Channel, where I keep posting in-depth tutorials and all edutainment stuff for software developers.