help Command in Linux

Learn via video courses
Topics Covered

Overview

In the wide world of Linux, the 'help' command serves as a lifeline for beginners and experts alike. The help command in Linux is used to get the documentation about the built-in shell commands. It provides users with essential information about how to use commands and their options, making it a vital tool in your Linux skillset.

Syntax of help Command in Linux

The basic syntax of the help command in Linux is as follows:

Where:

  • option: This is an optional part of the syntax which represents the specific help command option to be used.
  • pattern: Pattern specifies the command you want to get help for. It's an optional part, if not specified, the help command will display a brief summary of all built-in commands.

Options in help Command in Linux

  1. -d, --detailed: This option shows a detailed description of the command.

    For example -

    Output:

    This command gives a detailed description of the 'cd' command.

  2. -m, --man: This option displays help information in the manpage style.

    For example -

    Output:

    This command gives the 'manpage' style information of the 'cd' command.

  3. -s, --short: This option provides a short usage description for the specified command.

    For example -

    Output:

    This command gives a short description of how to use the 'cd' command.

Example Usages

  • General use of help command:

    Output:

    Explanation: Running the help command with no arguments will return a list of all built-in shell commands along with a brief summary of each.

  • Getting help for a specific command:

    Output:

    Explanation: This command displays information about the 'cd' command.

Tips

  • Remember to use the help command in Linux whenever you're unsure about a command or its usage. It can be an excellent tool for learning and understanding Linux commands.

  • The 'help' command only works with built-in shell commands. For external commands or programs, use 'man' or 'info'.

Advanced Use Cases of help Command in Linux

  • Use help with wildcard to list commands starting with a specific letter:

    Output:

    Explanation: This command shows the help topics for all commands that start with 'c'.

  • Use help with regular expressions to list specific commands:

    Output:

    Explanation: This command gives detailed help on commands that start with either 'ca' or 'cd'.

  • Show manpage style help for all commands starting with a specific letter:

    Output:

    Explanation: This command displays manpage style help for all commands starting with 'a' or 'b'.

Conclusion

  • The help command in Linux provides valuable information about built-in shell commands and their usage.

  • Options like '-d', '-m', and '-s' can be used for detailed, manpage style, and short help information respectively.

  • Help command can be used with patterns and wildcards to list help topics for specific groups of commands.