help Command in Linux with examples

If you are new to LINUX operating system and having trouble dealing with the command-line utilities provided by LINUX then you really need to know first of all about the help command which as its name says help you to learn about any built-in command.
help command as told before just displays information about shell built-in commands. Here’s the syntax for it:

// syntax for help command

$help [-dms] [pattern ...]

The pattern specified in the syntax above refers to the command about which you would like to know and if it is matched with any shell built-in command then help give details about it and if it is not matched then help prints the list of help topics for your convenience. And the d, m and s here are options that you can use with the help command.

Using help command



To make you understand more easily about what help command does let’s try help command for finding out about help itself.

// using help

$help help
help: help [-dms] [pattern...]
    Display information about builtin commands.

    Displays brief summaries of builtin commands. If PATTERN IS
    specified, gives detailed help on all commands matching PATTERN,
    otherwise the list of help topics is printed.

    Options:
      -d        output short description for each topic
      -m        display usage in pseudo-manpage format
      -s        output only a short usage synopsis for each topic matching
        PATTERN

    Arguments:
      PATTERN   Pattern specifying a help topic

    Exit Status:
    Returns success unless PATTERN is not found or an invalid option is given.

/* so that's what help command
does telling everything
about the command and 
helping you out */

Options for help command

  • -d option : It is used when you just want to get an overview about any shell built-in command i.e it only gives short description.
  • -m option : It displays usage in pseudo-manpage format.
  • -s option : It just displays only a short usage synopsis for each topic matching.

Using help with options

  • Using -d : This option just lets you know about what a command does without giving you details about its options and other stuff.
    // using help with -d
    
    $help -d help
    help - Display information about builtin commands.
    
  • Using -s : This option is when you just want to know about the syntax of a command.
    // using help with -s 
    
    $help -s help
    help: help [-dms] [pattern ...]
    
  • Using -m : This is used to display information about a command in pseudo-manpage format.
    // using help with -m
    
    $help -m help
    NAME
        help - Display information about builtin commands.
    SYNOPSIS
        help [-dms] [pattern ...]
    DESCRIPTION
        Display information about builtin commands.
    
        Displays brief summaries of builtin commands. If PATTERN IS
        specified, gives detailed help on all commands matching PATTERN,
        otherwise the list of help topics is printed.
    
        Options:
          -d        output short description for each topic
          -m        display usage in pseudo-manpage format
          -s        output only a short usage synopsis for each topic matching
            PATTERN
    
        Arguments:
          PATTERN   Pattern specifying a help topic
    
        Exit Status:
        Returns success unless PATTERN is not found or an invalid option is given.
    
    SEE ALSO
        bash(1)
    IMPLEMENTATION
        GNU bash,version 4.3.11(1)-release (i686-pc-linux-gnu)
        Copyright (C) 2013 Free Software Foundation, Inc.
        License GPLv3+: GNU GPL version 3 or later 
    
    

So that’s all about help command.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.