help Command in Linux with examples
Last Updated :
10 Sep, 2024
If you’re new to the Linux operating system and struggling with command-line utilities, the help command is one of the first tools you should learn. As its name suggests, the ‘help’ command provides detailed information about built-in shell commands, making it an essential resource for beginners and experienced users alike. This command helps you understand the functionality, syntax, and options of built-in commands in Linux, simplifying your command-line experience.
What is the ‘help’ Command?
The ‘help’ command is used to display information about shell built-in commands directly from the terminal. It’s an invaluable tool for quickly learning how to use various commands without needing to leave the command line or search online. Whether you’re unsure of a command’s options or need a quick reminder of its syntax, the help command provides a convenient solution.
Syntax of the help Command:
Here’s the syntax for it:
$help [-dms] [pattern ...]
Here, 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 the ‘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 the ‘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
1. Using -d: Overview of Commands
The ‘-d’ option provides a brief overview of the command without delving into details like options or arguments. It’s useful when you need a quick understanding of what a command does.
// using help with -d
$help -d help
help - Display information about builtin commands.
2. Using -s: Syntax Only
The ‘-s’ option is useful when you want to see the syntax of a command without additional descriptions. This is particularly handy when you’re familiar with the command but need a quick reminder of the correct syntax.
// using help with -s
$help -s help
help: help [-dms] [pattern ...]
3. Using -m: Pseudo-Manpage Format
The ‘-m’ option displays information in a format that resembles traditional man pages. This option provides a comprehensive view, including descriptions, syntax, options, arguments, and related commands.
// 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
Conclusion
The ‘help’ command is an invaluable tool in the Linux environment, offering immediate access to detailed information about shell built-in commands. Understanding how to use the help
command can enhance your command-line skills, improve your efficiency, and reduce the need for external resources.
help Command in Linux – FAQs
What is the ‘help’ command used for in Linux?
The ‘help’ command in Linux provides information about shell built-in commands. It displays summaries, syntax, options, and usage details for commands directly from the terminal.
How does the ‘help’ command differ from man?
The ‘help’ command is specifically for shell built-in commands, offering quick and concise information. In contrast, ‘man’ provides detailed manuals for a wider range of commands and programs, including external ones.
How do I use the help command to learn about another command?
Use the help command followed by the name of the built-in command:
help [command]
For example, to learn about the ‘echo’ command:
help echo
What does the ‘-d’ option do in the help command?
The ‘-d’ option provides a brief overview of a shell built-in command, summarizing what it does without detailed descriptions of options or syntax.
help -d help
What does the ‘-m’ option do in the help command?
The ‘-m’ option displays the information in a pseudo-manpage format, which includes detailed descriptions, syntax, options, and related commands.
help -m help
Similar Reads
How to Delete a Group in Linux | groupdel command
Group management is a crucial aspect of Linux system administration, and understanding how to create, modify, and delete groups is essential for maintaining a secure and organized environment. In this article, we will delve into the process of deleting a group in Linux using the 'groupdel' command.
3 min read
groupmod command in Linux with examples
groupmod command in Linux is used to modify or change the existing group on Linux system. It can be handled by superuser or root user. Basically, it modifies a group definition on the system by modifying the right entry in the database of the group. Syntax: groupmod [option] GROUP Files: The groupmo
2 min read
Groups Command in Linux With Examples
In Linux, there can be multiple users (those who use/operate the system), and groups are nothing but a collection of users. Groups make it easy to manage users with the same security and access privileges. A user can be part of different groups. The 'groups' command is a powerful tool that allows ad
3 min read
grpck command in Linux with Examples
grpck command in Linux System verifies the integrity of the groups' information. It checks that all entries in /etc/group and "/etc/gshadow" have the proper format and contain valid data. The user is prompted to delete entries that are incorrectly formatted or which have uncorrectable errors. Syntax
5 min read
grpconv command in Linux with examples
The grpconv command in Linux is used to convert groups to shadow groups. Shadow groups offer enhanced security by moving group passwords into the shadow group file (/etc/gshadow), which is not readable by normal users, thus protecting sensitive information. The grpconv command works by creating or u
5 min read
gs command in Linux with Examples
gs command invokes Ghostscript, which is an interpreter of Adobe Systems PostScript and Portable Document Format(PDF) languages. After executing Ghostscript it reads further input from the standard input stream until it encounters 'quit' command. Syntax: gs [ options ] [ files ] ... Options: Below a
2 min read
gunzip command in Linux with examples
The gunzip command in Linux is one the widely used tools for decomposing files that were compressed using gzip. It allows easy unzipping files, making it easy for file management and disk space optimization in Linux environments. In this article, you will understand whether you work with log files,
5 min read
halt command in Linux with examples
This command in Linux is used to instruct the hardware to stop all the CPU functions. Basically, it reboots or stops the system. If the system is in runlevel 0 or 6 or using the command with --force option, it results in rebooting of the system otherwise it results in shutdown. Syntax: halt [OPTION]
2 min read
hash command in Linux with examples
The `hash` is a command in Linux that helps in managing the hash table. It facilitates with mapping the names of executable files to their locations on disk. It helps in speeds uping the commands execution by remembering paths of frequently used commands. It uses the `hash` to view hashed commands (
5 min read
hdparm command in Linux with Examples
"hdparm" (i.e., hard disk parameter) is one of the command line programs for Linux that is used to handle disk devices and hard disks. With the help of this command, you can get statistics about the hard disk, alter writing intervals, acoustic management, and DMA settings. It can also set parameters
4 min read