Bash: Manpage Help β Use help, man, and --help to Learn Bash Commands
Introduction to Bash Help Commands β Get Instant Documentation with help, man, and --help
Bash offers several built-in ways to get command documentation and syntax details directly from the terminal. Whether you want to understand a built-in like cd, check full manuals for system commands, or view quick usage options, Bash gives you everything via:
helpβ for Bash built-insmanβ for full manual pages (external commands)--helpβ for quick flags/usage (external programs)
These are essential tools for both beginners and advanced users to write scripts efficiently without needing to Google every command.
In this article, youβll learn:
- The difference between
help,man, and--help - When to use each command
- How to explore built-ins and external tools
- Real-world tips to speed up learning
1. help β Learn About Bash Built-in Commands
The help command shows usage info for Bash built-ins like cd, echo, if, read, trap, etc.
Example:
help cd
Output:
cd: cd [-L|[-P [-e]] [-@]] [dir]
Change the shell working directory.
Works only for built-ins that are part of the Bash interpreter.
List all built-ins:
help
Useful when you want to learn Bash syntax without external documentation.
2. man β Access Full Manual Pages
The man (manual) command shows detailed manuals for external commands like ls, grep, find, tar, etc.
Example:
man ls
Opens a scrollable page with:
- Command description
- Options and examples
- Author notes and standards
Use
/to search within manpages andqto quit.
3. --help β Get Quick Command-Line Usage
Most external commands support the --help option for quick syntax and flag reference.
Example:
grep --help
Output:
Usage: grep [OPTION]... PATTERNS [FILE]...
Faster than
manfor simple reference, and great when scripting on the fly.
Summary Table β Help Commands
| Command | Used For | Works On | Example |
|---|---|---|---|
help | Short Bash built-in info | Bash built-ins only | help exit |
man | Full documentation | External commands | man grep |
--help | Quick syntax help | External commands | cp --help |
Bonus: Learn Which One to Use
Use type to find out what kind of command you’re dealing with:
type cd
# cd is a shell builtin
type grep
# grep is /bin/grep
This helps you choose between help and man/--help.
Summary β Bash Help Commands
Bash makes it easy to access built-in help, full manuals, and quick usage info without leaving the terminal. Use help for Bash syntax, man for detailed command docs, and --help for fast flag lookups.
Key Takeaways:
- Use
helpfor built-ins likecd,trap,echo, etc. - Use
manfor detailed info on tools likeawk,ls,tar - Use
--helpfor quick usage hints with examples
Real-world Uses:
- Debugging scripts with correct command syntax
- Exploring unknown commands in real-time
- Saving time with built-in references
FAQ β Bash Help Commands
Whatβs the difference between help and man?
help is for Bash built-in commands only.
man is for external system commands like ls, tar, grep.
How can I find out whether a command is built-in?
Use:
type command_name
Can I use --help with any command?
Most external commands support it, but not all. Built-ins like cd donβt support --help.
What if man doesn’t work on my system?
Install man pages using:
sudo apt install man-db
Or:
sudo yum install man
Is there a way to view only options for a command?
Yes, try:
command --help | less
To scroll through the options easily.
Share Now :
