🧠 5. Bash Internals & Shell Behavior
Estimated reading: 3 minutes 475 views

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-ins
  • man – 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 and q to 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 man for simple reference, and great when scripting on the fly.


Summary Table – Help Commands

CommandUsed ForWorks OnExample
helpShort Bash built-in infoBash built-ins onlyhelp exit
manFull documentationExternal commandsman grep
--helpQuick syntax helpExternal commandscp --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 help for built-ins like cd, trap, echo, etc.
  • Use man for detailed info on tools like awk, ls, tar
  • Use --help for 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 :
Share

🟒 Bash: Manpage Help (help)

Or Copy Link

CONTENTS
Scroll to Top