Linux CLI 8 ๐ง help, –help and man
These three tools help you learn how to use commands โ from quick built-in help to full documentation manuals. Knowing how to use them is essential for becoming self-sufficient on the command line.
Overview
| Tool | Purpose | Best For |
|---|---|---|
help | Help for bash builtins | Built-in commands like cd, echo |
--help | Quick help for external commands | Most command-line tools |
man | Full manual pages | Detailed documentation |
The help Command
The help command displays information about bash built-in commands.
help
help cd
help -d cd
help -s cd
help -m cd
| Command | Description |
|---|---|
help | List all bash builtins |
help cd | Show help for the cd builtin |
help -d cd | Show a short description |
help -s cd | Show a short synopsis |
help -m cd | Display help in pseudo-manpage format |
Examples
List all builtins:
$ help
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
job_spec [&] history [-c] [-d offset] [n] ...
(( expression )) if COMMANDS; then COMMANDS; ...
. filename [arguments] jobs [-lnprs] [jobspec ...] ...
: kill [-s sigspec | -n signum ...
[ arg... ] let arg [arg ...]
[[ expression ]] local [option] name[=value] ...
alias [-p] [name[=value] ... ] logout [n]
bg [job_spec ...] mapfile [-d delim] [-n count] ...
bind [-lpsvPSVX] [-m keymap] ... popd [-n] [+N | -N]
break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]
caller [expr] pwd [-LP]
case WORD in [PATTERN [| PATTERN]...) read [-ers] [-a array] ...
cd [-L|[-P [-e]] [-@]] [dir] readarray [-d delim] [-n count] ...
command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...]
compgen [-abcdefgjksuv] [-o option] ... return [n]
complete [-abcdefgjksv] [-pr] ... select NAME [in WORDS ... ;] do ...
compopt [-o|+o option] [-DEI] [name ...] set [-abefhkmnptuvxBCEHPT] ...
continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
declare [-aAfFgiIlnrtux] [-p] ... source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec ... | pid ...] test [expr]
echo [-neE] [arg ...] time [-p] pipeline
enable [-a] [-dnps] [-f filename] ... times
eval [arg ...] trap [-lp] [[arg] signal_spec ...]
exec [-cl] [-a name] [command ...] true
exit [n] type [-afptP] name [name ...]
export [-fn] [name[=value] ...] ... typeset [-aAfFgiIlnrtux] [-p] ...
false ulimit [-SHabcdefiklmnpqrstuvxPT] ...
fc [-e ename] [-lnr] [first] [last] ... umask [-p] [-S] [mode]
fg [job_spec] unalias [-a] name [name ...]
for NAME [in WORDS ... ] ; do COMMANDS; done unset [-f] [-v] [-n] [name ...]
for (( exp1; exp2; exp3 )); do COMMANDS; done until COMMANDS; do COMMANDS; done
function name { COMMANDS ; } or name () { COMMANDS ; } variables - Names and meanings of ...
getopts optstring name [arg ...] wait [-fn] [-p var] [id ...]
hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do COMMANDS; done
help [-dms] [pattern ...] { COMMANDS ; }
Help for a specific builtin:
$ help cd
cd: cd [-L|[-P [-e]] [-@]] [dir]
Change the shell working directory.
Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.
Options:
-L force symbolic links to be followed: resolve symbolic
links in DIR after processing instances of `..'
-P use the physical directory structure without following
symbolic links: resolve symbolic links in DIR before
processing instances of `..'
...
Short description (-d):
$ help -d cd
cd - Change the shell working directory.
Short synopsis (-s):
$ help -s cd
cd: cd [-L|[-P [-e]] [-@]] [dir]
Pseudo-manpage format (-m):
$ help -m cd
NAME
cd - Change the shell working directory.
SYNOPSIS
cd [-L|[-P [-e]] [-@]] [dir]
DESCRIPTION
Change the current directory to DIR.
...
When to Use help
Use help for… | Example |
|---|---|
| Shell builtins | help cd, help echo |
| Bash-specific commands | help declare, help local |
| Checking builtin options | help -m read |
Note:
helponly works for bash builtins โ not for external commands likelsorcp. For those, use--helporman.
The --help Option
Most commands support the --help option โ a common command-line argument that displays help information.
cp --help
cp --help | less
| Command | Description |
|---|---|
cp --help | Show help for the cp command |
cp --help | less | Show help one screen at a time |
ls --help | Help for ls |
grep --help | Help for grep |
Examples
$ cp --help
Usage: cp [OPTION]... [-T] SOURCE DEST
or: cp [OPTION]... SOURCE... DIRECTORY
or: cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.
-a, --archive same as -dR --preserve=all
--attributes-only don't copy the file data, just the attributes
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
--copy-contents copy contents of special files when recursive
-d same as --no-dereference --preserve=links
-f, --force if an existing destination file cannot be
opened, remove it and try again (this option
is ignored when the -n option is also used)
-i, --interactive prompt before overwrite (overrides a previous -n
option)
-H follow command-line symbolic links in SOURCE
-l, --link hard link files instead of copying
-L, --dereference always follow symbolic links in SOURCE
-n, --no-clobber do not overwrite an existing file (overrides
a previous -i option)
-P, --no-dereference never follow symbolic links in SOURCE
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST] preserve the specified attributes (default:
mode,ownership,timestamps), if possible
additional attributes: context, links, xattr,
all
--no-preserve=ATTR_LIST don't preserve the specified attributes
--parents use full source file name under DIRECTORY
-R, --recursive copy directories recursively
--reflink[=WHEN] control clone/CoW copies. See below
--remove-destination remove each existing destination file before
attempting to open it (contrast with --force)
--sparse=WHEN control creation of sparse files. See below
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-s, --symbolic-link make symbolic links instead of copying
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY
-T, --no-target-directory treat DEST as a normal file
-u, --update copy only when the SOURCE file is newer
than the destination file or when the
destination file is missing
-v, --verbose explain what is being done
-x, --one-file-system stay on this file system
-Z set SELinux security context of destination
file to default type
--context[=CTX] like -Z, or if CTX is specified then set the
SELinux or SMACK security context to CTX
--help display this help and exit
--version output version information and exit
...
Piping to less for long output:
$ cp --help | less
# Now you can scroll with โ/โ, PgUp/PgDn, q to quit
Why this matters: Some commands have hundreds of lines of help. Piping to less lets you read it comfortably.
When to Use --help
Use --help for… | Example |
|---|---|
| External commands | cp --help, ls --help |
| Quick reference | When you need a quick reminder of options |
| Common tools | Most GNU/Linux tools support it |
| Piping to less | command --help | less for long output |
Note:
--helpis not universal โ some commands use-h,-help, or nothing. When in doubt, tryman.
The man Command
The man command displays the manual pages for commands and system functions.
man ls
man 2 mkdir
man -f mkdir
man -w mkdir
man -a write
| Command | Description |
|---|---|
man ls | Full manual for ls |
man 2 mkdir | Manual from section 2 for mkdir |
man -f mkdir | Short description |
man -w mkdir | Location of the man page |
man -a write | Show all sections for write |
Manual Sections
Manual pages are organized into sections (usually 1โ9):
| Section | Content | Example |
|---|---|---|
| 1 | User commands | ls, cp, grep |
| 2 | System calls (kernel) | open, read, write |
| 3 | Library functions | printf, malloc |
| 4 | Special files (devices) | /dev/null, /dev/tty |
| 5 | File formats | /etc/passwd, fstab |
| 6 | Games | โ |
| 7 | Miscellaneous | man, regex, signal |
| 8 | System administration | mount, fdisk, systemctl |
| 9 | Kernel routines | โ |
Why sections matter: The same name can mean different things in different sections.
$ man mkdir # Section 1 โ the command
$ man 2 mkdir # Section 2 โ the system call
$ man 3 printf # Section 3 โ the library function
$ man 1 printf # Section 1 โ the command
Common man Options
| Option | Description |
|---|---|
-f | Show short description (like whatis) |
-w | Show location of the man page |
-a | Show all sections (in order) |
-k | Search descriptions (keyword search) |
-S | Restrict to specific sections |
-P | Use a specific pager |
Examples
Basic manual:
$ man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by
default). Sort entries alphabetically if none of -cftuvSUX nor
--sort is specified.
Mandatory arguments to long options are mandatory for short
options too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
...
Short description:
$ man -f mkdir
mkdir (1) - make directories
mkdir (2) - create a directory
Find location:
$ man -w mkdir
/usr/share/man/man1/mkdir.1.gz
$ man -w 2 mkdir
/usr/share/man/man2/mkdir.2.gz
All sections:
$ man -a write
# Shows write(1), then write(2), then write(3) โ all sections
Keyword search:
$ man -k copy
cp (1) - copy files and directories
cpio (1) - copy files to and from archives
dd (1) - convert and copy a file
install (1) - copy files and set attributes
...
Navigating man Pages
The man command uses less as its pager. Here are the navigation shortcuts:
| Key | Action |
|---|---|
Space | One screen ahead |
b | One screen back |
Enter | One line ahead |
โ / โ | Line up / down |
g | Go to beginning |
G | Go to end |
/searchTerm | Search ahead |
n | Next occurrence |
N | Previous occurrence |
h | Help (more shortcuts) |
q | Quit |
Examples:
$ man ls
# Press /recursive to search for "recursive"
# Press n to find next occurrence
# Press h to see help
# Press q to quit
Complete Example Session
# ============================================
# PART 1: HELP COMMAND (BUILTINS)
# ============================================
# List all builtins
$ help
# (long list of builtins)
# Help for a specific builtin
$ help cd
cd: cd [-L|[-P [-e]] [-@]] [dir]
Change the shell working directory.
...
# Short description
$ help -d cd
cd - Change the shell working directory.
# Short synopsis
$ help -s cd
cd: cd [-L|[-P [-e]] [-@]] [dir]
# Pseudo-manpage format
$ help -m cd
NAME
cd - Change the shell working directory.
...
# ============================================
# PART 2: --help (EXTERNAL COMMANDS)
# ============================================
# Quick help for cp
$ cp --help
Usage: cp [OPTION]... [-T] SOURCE DEST
...
# Pipe long help to less
$ cp --help | less
# (scrollable)
# Help for ls
$ ls --help
Usage: ls [OPTION]... [FILE]...
...
# ============================================
# PART 3: MAN (FULL DOCUMENTATION)
# ============================================
# Manual for ls
$ man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
...
# Specific section
$ man 2 mkdir
MKDIR(2) Linux Programmer's Manual MKDIR(2)
NAME
mkdir - create a directory
...
# Short description
$ man -f mkdir
mkdir (1) - make directories
mkdir (2) - create a directory
# Location of man page
$ man -w mkdir
/usr/share/man/man1/mkdir.1.gz
# All sections
$ man -a write
# (shows write(1), write(2), etc.)
# Keyword search
$ man -k copy
cp (1) - copy files and directories
cpio (1) - copy files to and from archives
...
# ============================================
# PART 4: NAVIGATION IN MAN
# ============================================
$ man ls
# Press Space โ next screen
# Press b โ previous screen
# Press /recursive โ search for "recursive"
# Press n โ next occurrence
# Press h โ help
# Press q โ quit
Quick Reference
help Commands
| Command | Description |
|---|---|
help | List all builtins |
help name | Full help for a builtin |
help -d name | Short description |
help -s name | Short synopsis |
help -m name | Manpage format |
--help Option
| Command | Description |
|---|---|
cmd --help | Quick help for external command |
cmd --help | less | Scrollable help |
man Commands
| Command | Description |
|---|---|
man cmd | Full manual |
man N cmd | Section N manual |
man -f cmd | Short description |
man -w cmd | Location of man page |
man -a cmd | All sections |
man -k keyword | Search by keyword |
man Navigation
| Key | Action |
|---|---|
Space | Page forward |
b | Page back |
/term | Search |
n / N | Next / previous match |
h | Help |
q | Quit |
Which Tool to Use
| Situation | Use |
|---|---|
| Shell builtin | help name |
| Quick reference | cmd --help |
| External command | man cmd |
| Multiple sections | man -a cmd |
| Search by keyword | man -k keyword |
| See what section | man -f cmd |
| Find the man page | man -w cmd |
Best Practices
โ Do This:
# Use help for builtins
help cd
# Use --help for quick reference on external commands
cp --help | less
# Use man for full documentation
man cp
# Search within man pages
man ls
# then press /recursive
# Use man -k to discover commands
man -k "copy files"
# Check multiple sections
man -a write
# Use -f to find the right section
man -f mkdir
โ Don’t Do This:
# Don't use help for external commands
help ls # โ Won't work
# Don't forget to pipe long help to less
cp --help # โ ๏ธ Floods your terminal
cp --help | less # โ
Better
# Don't skip sections when a name appears in multiple sections
man mkdir # Might not be the one you want
man 2 mkdir # โ
Specific section
# Don't forget to quit man
man ls
# Press q to quit โ don't just close the terminal!
Common Pitfalls
| Pitfall | Problem | Solution |
|---|---|---|
Using help for external commands | No output | Use --help or man |
Long --help output | Floods terminal | Pipe to less |
Wrong section in man | Shows wrong page | Use man N cmd |
Can’t quit man | Stuck in pager | Press q |
| Not finding a command | Wrong name | Use man -k keyword |
Real-World Examples
1. Learning a New Command
# Start with --help for quick overview
tar --help | less
# Then read the man page for details
man tar
# Search for a specific option
man tar
# press /--extract
2. Finding the Right Command
# Search man pages by keyword
man -k "find files"
# Returns: find(1), locate(1), mlocate(1), ...
# Choose and read
man find
3. Understanding a Builtin
# help for builtins
help read
# For more on read:
help -m read | less
4. Finding Which Section to Use
# Multiple sections match "mkdir"
man -f mkdir
mkdir (1) - make directories
mkdir (2) - create a directory
# Read section 1
man 1 mkdir
5. Quick Reference While Working
# In the middle of a task, need cp options
cp --help | grep preserve
# Shows:
# -p same as --preserve=mode,ownership,timestamps
# --preserve[=ATTR_LIST] preserve the specified attributes
Visual: Which Tool for What
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ You want to learn about a command... โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโดโโโโโโโโโโ
โ โ
Is it a builtin? Is it external?
โ โ
โผ โผ
โโโโโโโโโโโ โโโโโโโโโโโโ
โ help โ โ --help โ
โ name โ โ (quick) โ
โโโโโโโโโโโ โโโโโโโฌโโโโโ
โ
โ Need more detail?
โผ
โโโโโโโโโโโ
โ man โ
โ name โ
โโโโโโโโโโโ
Summary
| Command | Purpose | Example |
|---|---|---|
help | Help for bash builtins | help cd |
--help | Quick help for external commands | cp --help |
man | Full manual pages | man cp |
Key takeaways:
helpworks only for bash builtins โ usehelp -d,-s,-mfor different formats--helpis a common option for external commands โ pipe tolessfor long outputmanprovides complete documentation organized into 9 sections- Use
man -fto find the right section,man -wto find the file,man -kto search - Navigate
manpages with Space, b, /search, n, h, q
Remember: You don’t need to memorize every command and option. The three tools โ help, --help, and man โ let you look up what you need when you need it. Use them liberally โ they’re your built-in reference manual for the entire system!
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!