help command tutorial in linux/unix with examples

Help command can help you understand any built-in commands in linux/unix. For newcomers to the Linux/Unix operating system, if you encounter trouble using the built-in commands, we can use the help command to view its help manual.

Demo environment Mac os


help [-s] [pattern ...]

Display helpful information about builtin commands.
If PATTERN is specified, gives detailed help on all commands matching PATTERN, otherwise a list of the builtins is printed.
The -s option restricts the output for each builtin command matching PATTERN to a short usage synopsis.


In the following example, the help command is used to display the help manual of the cd command.

bash-3.2$ help cd

Use the help -s option to display only the syntax of the command.

bash-3.2$ help -s cd
cd: cd [-L|-P] [dir]

Demo environment Ubuntu os


help [-dms] [pattern ...]
      -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
      PATTERN	Pattern specifying a help topic


Use -s: This option is only used when you only want to understand the syntax of the command.

$ help -s cd
cd: cd [-L|[-P [-e]] [-@]] [dir]

Use -d: This option only lets you know what the command does, but does not provide detailed information about its options and other content.

$ help -d cd
cd - Change the shell working directory.

Use -m: Used to display information about commands in pseudo manual format.

$ help -m cd
    cd - Change the shell working directory.

    cd [-L|[-P [-e]] [-@]] [dir]

    Change the shell working directory.

View more information about the help command:

bash-3.2$ help help

Add a Comment

Your email address will not be published. Required fields are marked *