π 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 :
