TL;DR
Here is how you can use the help command in Linux:
- help Command for Utility: Type help followed by the utility name to get information, e.g., help pwd displays details about the pwd utility.
- 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:
- If you need help with the
pwd
utility, you can execute the following command in the Terminal app:
help pwd
- You’ll see the following output within the Linux command prompt.
![help command for utility](https://laclinux.com/wp-content/uploads/2023/04/help-command-for-utility-1024x750.jpg)
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:
- In the Terminal app, run the following command:
tar --help
- You’ll get the following output:
![help command in linux for application](https://laclinux.com/wp-content/uploads/2023/04/help-command-in-linux-for-application-1024x750.jpg)
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.
- -d for Brief Description: The
-d
option is used with thehelp
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](https://laclinux.com/wp-content/uploads/2023/04/d-for-brief-description-1024x750.jpg)
- -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](https://laclinux.com/wp-content/uploads/2023/04/m-for-the-manpage-format-1024x750.jpg)
- -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](https://laclinux.com/wp-content/uploads/2023/04/s-for-command-syntax-1024x750.jpg)
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:
- Launch the Terminal app and run the following command:
info bash
![info command for linux](https://laclinux.com/wp-content/uploads/2023/04/info-command-for-linux-1024x750.jpg)
- Here is the output of this command:
![info general manual](https://laclinux.com/wp-content/uploads/2023/04/info-general-manual-1024x750.jpg)
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:
- Type the following command in the Linux command prompt:
man ls
![man command for linux](https://laclinux.com/wp-content/uploads/2023/04/man-command-for-linux-1024x750.jpg)
- Once executed, you’ll see the following output:
![man detailed documentation](https://laclinux.com/wp-content/uploads/2023/04/man-detailed-documentation-1024x750.jpg)
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:
- 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](https://laclinux.com/wp-content/uploads/2023/04/for-application-specific-help-1024x750.jpg)
- Similarly, you can find help for the same command by typing man git. And this will get the following output:
![man git manual](https://laclinux.com/wp-content/uploads/2023/04/man-git-manual-1024x750.jpg)
- Lastly, you can also use the info command to view the information of this app. Here is the output:
![info manual linux](https://laclinux.com/wp-content/uploads/2023/04/info-manual-linux-1024x750.jpg)
Comparison of help
, man
, and info
Commands
Feature | help | man | info |
---|---|---|---|
Purpose | Quick reference for built-in shell commands | Detailed manual pages for commands and programs | Comprehensive documentation with navigation options |
Usage Command | help [command] | man [command] | info [command] |
Output Type | Concise, simplified output | Detailed, structured manual pages | Detailed, structured, with hyperlinks |
Scope | Built-in shell commands only | Most commands and programs | Commands, programs, and detailed documentation |
Navigation | No navigation options | Scroll with keyboard | Hyperlinked sections for easy navigation |
Depth of Information | Basic | Detailed | Very detailed |
Examples | help cd , help echo | man ls , man bash | info 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:
- How to run commands in the background, allowing you to multitask and manage processes more effectively in Linux.
- Discover 50 essential Linux commands that every user should know to increase your productivity and command-line efficiency.
- Learn how to use the
read
command to create interactive scripts, enhancing your scripting capabilities.
Frequently Asked Questions
Can I get help for third-party apps using the help command in Linux?
How can I exit the help documentation?
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?
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?
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?
man fstab
command to learn about the file system table, which controls how file systems are mounted and accessed on your system.