Help command in Linux

Help Command

The help command is the simplest way to get information regarding a built-in shell command. It helps you fetch information from the shell’s internal documentation.

It takes a text string as the command line argument and looks for the provided string in the shell’s documents. This saves you the time spent in going through the entire documentation.

The help command comes in handy when you want to know the options available with a command.

Help command itself offers three options:

  • -d: display only a brief description of the specified command.
  • -m: organize the available information just as the man command does.
  • -s: display the command syntax of the specified command.

The Linux help Command in Action

Let’s try using help on some common commands.

help cd
Help Cd

We get everything we want to know about cd command. Let’s try another command.

help pwd
Help Pwd

You can even use the help command on help itself. That’s like the movie inception.

help help
Help Help

Now let’s look at the options available along with help command.

1. Using the -d option to output short description for each topic

As mentioned above, -d flag gives a brief description of the command.

help -d cd 
Help D Cd
help -d pwd
Help D Pwd
help -d help
Help D Help

We can see that -d flag gives a one line description for the command mentioned.

2. Using the -m option to output in pseudo-manpage format

The -m flag gives the output in manpage like format. Man is system’s manual viewer.

help -m pwd
Help M Pwd
Terminal output
Man Page
pwd Man Page

The second image is pwd’s man page. You can see the similarity between the two.

3. Using -s option to output only a short usage synopsis

-s flag displays the command syntax of the specified command.

help -s pwd
Help S Pwd
help -s cd 
Help S Cd
help -s help
Help S Help

Conclusion

This tutorial was about help command in Linux. I Hope you found it ‘helpful’.