Getting Help – Man Pages (`man`, `type`, `help`, `apropos`)

🔹 Why Help is Important

  • Linux has hundreds of commands, each with many options.

  • Even experts can't remember everything.

  • Linux provides built-in help systems for commands.


🔹 man – Manual Pages

📖 What is a man page?

  • Short for manual.

  • Contains documentation of a command/program.

🧠 Usage:

man <command>
  • Example:
man ls

📚 Man Page Structure:

Section

Description

Name

Command name and short description

Synopsis

Syntax of command usage (options/arguments)

Description

Detailed explanation of command

Options

Explanation of available flags

See Also

Related commands or references

✅ Text conventions:

  • Bold → type as shown.

  • Italic/Underline → replace with a real value.


🔹 Navigating man Pages

Key

Action

q

Quit

h

Show help (less viewer)

↑ / ↓

Scroll up/down

Ctrl + f or Space

Scroll forward one screen

Ctrl + b

Scroll backward one screen

g

Go to beginning

G

Go to end

/term

Search forward for "term"

?term

Search backward for "term"

n

Next search result

N

Previous search result


Example: Searching in man ls

bashCopyEditman ls
  • Press /sort → highlights all matches for "sort"

  • Use n and N to navigate matches


🔹 Shell Built-in vs Executable Commands

Command Type

Example

Has man page?

Use help?

Executable

ls, rm, apt

✅ Yes

❌ No

Shell Built-in

cd, alias, umask

❌ No

✅ Yes

✅ Check command type:

type <command>
type ls   # → shows path (executable)
type cd   # → shows "shell builtin"

🔹 Help for Built-in Commands

help <command>
  • Example:
help cd

🔹 Help for Executables

<command> --help
  • Works for both types (if supported)

  • Examples:

    ls --help
    cd --help
    rm --help
    

🔹 Extra: ifconfig Command

  • Displays and configures network interfaces

  • Might not be pre-installed:

💡 Install net-tools:

  • Ubuntu/Debian:
sudo apt install net-tools
  • CentOS/RHEL:
sudo dnf install net-tools

🔹 man -k and apropos

🔎 Search man pages for keywords:

man -k <keyword>
apropos <keyword>
  • Examples:
man -k ifconfig
man -k "copy files"
apropos uname

📌 Both commands show a list of related man pages.


✅ Summary

  • Use man for detailed documentation.

  • Use help for shell built-ins.

  • Use --help for quick command options.

  • Use type to identify command type.

  • Use man -k or apropos to search commands by keyword.

  • Learn to navigate man pages efficiently with less.

Updated on