How to Use the help Command in Linux [3 Simple Ways]

Written by

Reviewed by

Last updated: July 24, 2024

Expert verified

SVG Image

TL;DR

Here is how you can use the help command in Linux:

  1. help Command for Utility: Type help followed by the utility name to get information, e.g., help pwd displays details about the pwd utility.
  2. help Command for Application: Use the application name followed by –help to access its documentation, e.g., tar –help provides help for the tar application.

Keep reading to learn more about how to use the help command and explore other ways to find help in Linux.

Learning Linux commands can be tough, but there’s an easy solution: the help command. In this post, I’ll show you how to use the help command to get information about built-in shell commands quickly. You’ll learn its benefits, how to use it in different ways, and how it compares to other help commands.

I’ll also share tips for using the help command effectively and introduce other resources like man and info for more detailed command information. Let’s improve your command-line skills together.

What is the help Command?

The help command in Linux is a built-in shell command that provides information about other built-in shell commands. It helps you understand how to use these commands by showing their syntax and available options.

Basic Usage:

    help [command]

    Replace [command] with the name of the command you need help with. For example, help cd shows information about the cd command.

      Benefits of Using help Command

      • Built-in Shell Commands: Focuses specifically on built-in shell commands, making it easier to find information on commonly used commands.
      • Quick Access: The help command gives you immediate information about built-in commands without leaving the terminal.
      • Simplified Output: It provides concise and easy-to-read explanations, perfect for quick reference.

      How to Use the help Command in Linux – 3 Ways

      To use the help command in Linux, type help followed by the name of the built-in shell command you need assistance with, such as help cd. For applications, use the application name followed by --help, like tar --help. Additionally, you can customize the output using options: -d for a brief description, -m for manpage format, and -s for command syntax.

      Here are a few examples to give you an idea of how to use it to get help for utilities and applications in Linux:

      1. help Command for Utility 

      To use the help command, you just need to type help followed by the name of the utility you want help with. Here’s how you can do it:

      1. If you need help with the pwd utility, you can execute the following command in the Terminal app:
      help pwd
      1. You’ll see the following output within the Linux command prompt.
      help command for utility

      2. help Command for Application

      Similarly, if you want to use the help command to access the documentation of an application, just use the double hyphen (--) followed by the help command after the app name. Here’s an example of the tar app with the help command in the Linux command prompt:

      1. In the Terminal app, run the following command:
      tar --help
      1. You’ll get the following output:
      help command in linux for application

      3. help Command with Options

      Besides providing information on individual apps and utilities, the help command also accepts options that can help you customize the output. As of now, it offers three options, which are -d for a brief description,  -m for the manpage format, and -s for command syntax. I’ll implement each of these options on the cd command to help you understand how they work.

      1. -d for Brief Description: The -d option is used with the help command in Linux to obtain a brief one-line description of a command in Linux. This can be useful when you need a quick overview of what a command does without having to access its full manual page.
      help -d cd
      d for brief description
      1. -m for the Manpage Format: The -m option gives the output in manpage format, which is similar to the system’s manual viewer. This can be useful when you prefer to view the documentation in a more structured and organized format or when you need to access the full documentation for a command.
      help -m cd
      m for the manpage format
      1. -s for Command Syntax: The -s option with the help command in Linux displays the command syntax. This can be useful when you need to quickly reference the syntax of a command without having to access its full manual page.
      help -s cd
      s for command syntax

      3 Other Ways to Get Help in Linux

      The help is indeed a very useful tool in Linux, but some apps and utilities may not have documentation available through this command. In such cases, you can use other commands like info or man to find more information. Here’s the step-by-step breakdown of each method:

      1. Use the info Command

      To get information about any app or utility in Linux distribution, you can use the info command. Here are the steps for it:

      1. Launch the Terminal app and run the following command:
      info bash
      info command for linux
      1. Here is the output of this command:
      info general manual

      2. Use the man Command

      The man command in Linux is a useful tool that provides detailed documentation for various commands and programs. If you want to learn more about the ls command, you can use the following steps:

      1. Type the following command in the Linux command prompt:
      man ls
      man command for linux
      1. Once executed, you’ll see the following output:
      man detailed documentation

      In some cases, you may have to use the man -k commandname or man --help to find out more about available commands and apps.

      3. For Application-Specific Help

      Finally, some applications may have their own help command or documentation. For instance, git has its own help command that can be accessed. You can access its documentation in three ways. That includes using help, man, and info. Here’s how to do it:

      1. In the Linux command prompt, run the git help command, and you’ll see the following output within the Terminal app. 
      for application specific help
      1. Similarly, you can find help for the same command by typing man git. And this will get the following output:
      man git manual
      1. Lastly, you can also use the info command to view the information of this app. Here is the output:
      info manual linux

      Comparison of help, man, and info Commands

      Featurehelpmaninfo
      PurposeQuick reference for built-in shell commandsDetailed manual pages for commands and programsComprehensive documentation with navigation options
      Usage Commandhelp [command]man [command]info [command]
      Output TypeConcise, simplified outputDetailed, structured manual pagesDetailed, structured, with hyperlinks
      ScopeBuilt-in shell commands onlyMost commands and programsCommands, programs, and detailed documentation
      NavigationNo navigation optionsScroll with keyboardHyperlinked sections for easy navigation
      Depth of InformationBasicDetailedVery detailed
      Exampleshelp cd, help echoman ls, man bashinfo ls, info bash

      5 Quick Tips to Use the help Command in Linux

      The help command in Linux is a valuable tool that can help you find information about various commands and programs. To use it effectively, here are some tips and tricks that you can follow:

      • 📝 Tab completion: When typing the name of a command or application after help, you can use tab completion to fill in the rest of the name automatically. This can save you time and ensure you’re typing the correct name.
      • ⌨️ Keyboard Shortcuts: Keyboard shortcuts can help you navigate manual pages more efficiently. Some common keyboard shortcuts include Page Up and Page Down for scrolling through the manual pages and q for quitting the manual pages once you are finished reading them.
      • 🐞 Use the -d or –debug flag: If you’re having trouble with a specific command or application, using the -d or –debug flag can provide you with additional information that can help you resolve the issue.
      • 📚 Use the man command: As mentioned earlier, the man command provides detailed manual pages for a wide range of Linux commands and applications. It is indeed a great resource if you need more in-depth information than what the help command provides.
      • 🔍 Search online: If you’re unable to find the information you need through the help command or man pages, a quick online search can often provide you with the answers you need.

      In a Nutshell

      In this article, I have explored using the help command in Linux for utilities, applications, and with options to customize output. I have also discussed other help methods like man and info commands and provided quick tips for effectively using these resources.

      If you found this article useful, you might enjoy learning about:

      Frequently Asked Questions

      Can I get help for third-party apps using the help command in Linux?

      The availability of help documentation for third-party applications through the help command depends on the application. Some third-party applications may include manual pages that can be accessed using the man command, while others may have their own help commands that provide information on usage and options.

      How can I exit the help documentation?

      To exit the help documentation, you can type q or quit. Additionally, you can also press the Ctrl + C keyboard combination in some cases. However, make sure that you read the help documentation to expand your knowledge of Linux commands.

      Is there a way to search for specific keywords or phrases within the help documentation?

      Yes, you can use the grep command to search for specific keywords or phrases within the help documentation. For example, to search for information about file permissions, you could use the command man chmod | grep permissions. This will display all instances of the word permissions on the chmod manual page.

      What if I can’t find the command using the help command in Linux?

      If the command is not found using the help command in Linux, try to check if the command is installed, use the manual pages with the man command, search online for related information, or ask for help in a Linux community forum.

      Can I use the help command in Linux to learn about system settings?

      Yes, the help command can be used to learn about different Linux system settings. For instance, you can use the man fstab command to learn about the file system table, which controls how file systems are mounted and accessed on your system.

      Ojash

      Author

      Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.

      Akshat

      Reviewer

      Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

      Share this article
      Shareable URL
      Prev Post

      4 Best Ways to echo a New Line in Bash

      Next Post

      Fix Critical Sudo Bug CVE-2021-3156 Error in 4 Simple Steps

      Leave a Reply

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

      Read next