How to Use the Help Command in Linux

How to Use the Help Command in Linux

To find documentation for a Linux command, you need a help source that covers it. Bash’s help command displays documentation for shell commands such as cd and read.

I’ll show how to use help for Bash commands and where to look for documentation for external programs.

TL;DR: Use help for Bash builtins

In Bash, follow the builtin with a topic name and add an option when you need a shorter or differently formatted answer.

  • Use the full Bash help form for detailed builtin documentation.
  • Choose the short-description option, the synopsis option, or the manpage-like option to change the output.
  • For external programs, try the program’s help option or open its manual page.

What is the help command?

Bash help documents shell commands such as cd and read. Its syntax takes optional format flags and a topic name.

  • -d prints a brief description.
  • -s prints a usage synopsis.
  • -m formats the entry like a manual page.

Use an exact topic when you know its name. A prefix or shell wildcard can return multiple matching entries.

How to use the help command step by step

I ran Bash help for cd. The output describes syntax, options, behavior, and exit status.

Step 1: Check the builtin with help

The standard form gives the complete entry for the Bash builtin cd.

help cd
Bash help cd output showing syntax and options
Bash displays the cd syntax, behavior, options, and exit status.

Its first line is cd: cd [-L|[-P [-e]] [-@]] [dir]. The rest explains path handling and the listed options.

Step 2: Choose a compact output option

I ran the short-description form for cd from a named script and got one line back.

help -d cd
One-line output from help -d cd
The short-description option returns one line for cd.

The output is “cd – Change the shell working directory.” The synopsis and manpage-like options serve different lookup needs.

Step 3: Read the help for help

The builtin documents itself. I ran the builtin’s self-help form on Bash 5.2.21 and its synopsis groups the options as [-dms].

help help

It explains each output format and the status for a missing topic.

Common errors when Bash help finds no command

When I tested Bash with an external ls command, it returned this exact message: /usr/bin/bash: line 7: help: no help topics match `ls’. Try `help help’ or `man -k ls’ or `info ls’.

CaseSymptomNext command
Bash builtinA Bash topic existsBash help for cd
External executableBash reports no matching help topiccheck the program’s supplied documentation
Unknown command for a taskThe program name is uncleara manual-page keyword search or the short manual-page lookup

A manual page or Info entry is available only when the program or its package supplies one.

Our man command guide explains manual-page navigation. The Linux commands cheat sheet helps when the command name itself is unknown.

Check echo “$BASH_VERSION” to identify whether the current shell is Bash. An empty value tells you to look up the active shell’s own help system.

Conclusion

Use the format that matches the question: the full entry for behavior, a short description for a quick reminder, or a synopsis when you need the accepted form. The Bash Builtins reference documents the syntax and options, and the man guide covers manual pages.

FAQ

These answers clarify the option names and the right source for a command.

What does the help command do in Linux?

In Bash, help displays documentation for builtin commands and other Bash help topics.

How do I get help for an external Linux command?

Try the program’s –help option or read its manual with man command. Bash help is for Bash topics, not arbitrary executables.

What do -d, -m, and -s mean in Bash help?

The -d option prints short descriptions, -m formats output like a man page, and -s prints a short usage synopsis.