man
Cheatsheet
Basic Usage
Open the manual page for a command
man [command]
Example:
man ls
Navigation
Move Down One Line:
Down Arrow
orj
Move Up One Line:
Up Arrow
ork
Move Down One Page:
Space
orPage Down
Move Up One Page:
b
orPage Up
Jump to the Beginning:
g
Jump to the End:
G
Move Forward One Word:
w
Move Backward One Word:
b
Searching
Search Forward:
/keyword
Search Backward:
?keyword
Repeat Search Forward:
n
Repeat Search Backward:
N
Exiting
- Quit the Manual:
q
Viewing Sections
Manual pages are divided into sections, such as:
User commands
System calls
Library functions
Special files (e.g., device files)
File formats and conventions
Games and screensavers
Miscellaneous
System administration commands
Specify a Section:
man [section] [command]
Example:man 5 passwd
Useful Options
Display the Manual Page for a Specific Section
man [section] [command]
Example:
man 3 printf
Show All Manual Pages Matching a Command
man -a [command]
Example:
man -a printf
View Help for
man
Commandman man
Print the Manual Page to STDOUT
man [command] | cat
Example:
man ls | cat
Specify Locale for Manual Pages
man --locale=[locale] [command]
Example:
man --locale=fr ls
Search for a Command Across All Sections
man -k [keyword]
Example:
man -k passwd
Format and Display the Manual Page in a Custom Way
man -P [pager_command] [command]
Example:
man -P cat ls
Display a Short Description of a Command
whatis [command]
Example:
whatis ls
Search Manual Page Names and Descriptions
apropos [keyword]
Example:
apropos network
Combining man
with Other Commands
Save a Manual Page to a File
man [command] > [filename]
Example:
man ls > ls_manual.txt
Print the Manual Page with
col
to Remove Backspacesman [command] | col -b > [filename]
Example:
man ls | col -b > ls_manual.txt
Read a Compressed Manual Page
man -z [file]
Example:
man -z /usr/share/man/man1/ls.1.gz
Additional Tips
Man Page Sections Order: When you run
man [command]
without specifying a section,man
searches through the sections in a predefined order. Typically, section 1 is searched first.Customizing Pager: You can customize the pager used by
man
with thePAGER
environment variable. For example:export PAGER=less
This cheatsheet covers the essential commands and options for using the man
command effectively, from basic navigation and searching to advanced usage and combining with other commands. Adjust the commands according to your specific requirements and environment.