Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Shell Scripting
  • Kali Linux
  • Ubuntu
  • Red Hat
  • CentOS
  • Docker in Linux
  • Kubernetes in Linux
  • Linux interview question
  • Python
  • R
  • Java
  • C
  • C++
  • JavaScript
  • DSA
Open In App
Next Article:
modinfo command in Linux with Examples
Next article icon

How to Read Manual Pages in Linux | man Command

Last Updated : 10 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The “man” command, short for manual, is a powerful tool in the Linux operating system that allows users to access detailed information about various commands, utilities, and system calls. The “man” command provides comprehensive documentation, helping users understand how to use and configure different elements of the Linux environment. This article will explore the “man” command in detail, covering its syntax, and options, and providing practical examples.

Table of Content

  • What is man in Linux Command?
  • Man Command Options
  • Accessing Manual Pages
  • Navigating Manual Pages
  • Sections in Manual Pages
  • Types of sections in Man command Manuals
  • Examples of Man Command section types with Detailing
  • How to Search Manual Pages in Linux?
  • Alternative ways to read man pages

What is man in Linux Command?

The man command in Linux is used to display the manual pages for other commands and utilities. It provides detailed documentation about the usage, options, and functionality of commands, making it an essential tool for both beginners and experienced users. Each manual page includes sections such as NAME, SYNOPSIS, DESCRIPTION, OPTIONS, and EXAMPLES, which help users understand and effectively use the command.

Description

The man command is essentially the Linux manual reader. When you type man followed by a command name, it retrieves and displays the manual page for that command, offering comprehensive details on how to use it, including all available options and flags. This command is crucial for learning about the tools and commands available in the Linux operating system.

Syntax of the “man” Command

The basic syntax of the “man” command is as follows:

man [option] [command]

Here,

“option” refers to additional flags that modify the behavior of the “man” command,

“command” is the Linux command or utility for which you want to access the manual.

Man Command Options

The “man” command itself has options that enhance its functionality:

Option

Description

man [command]

Display the manual page for the specified command.

-f, –whatis

Display a concise one-line description of the command.

-k, –apropos

Search for commands related to a given keyword.

-a, –all

Display all matching manual pages for the specified command.

Spacebar

Move forward one page in the manual.

Enter

Move forward one line in the manual.

B

Move backward one page in the manual.

Q

Quit the manual viewer.

Accessing Manual Pages

  • To access the manual page for a specific command, simply type:
man [command]

For example: To view the manual for the “ls” command execute the following command:

man ls
  • This will display detailed information about the “ls” command, including its usage, options, and examples.

Navigating Manual Pages

Once you’ve accessed a manual page, you can navigate through it using various commands. The common navigation keys include:

  • Spacebar: Move forward one page.
  • Enter: Move forward one line.
  • B: Move backward one page.
  • Q: Quit the manual viewer.

Sections in Manual Pages

Manual pages are organized into different sections, each serving a specific purpose. The primary sections include:

  • NAME: Provides the name and a brief description of the command.
  • SYNOPSIS: Describes the syntax of the command.
  • DESCRIPTION: Offers a detailed explanation of the command’s functionality.
  • OPTIONS: Lists the available command-line options and their descriptions.
  • EXAMPLES: Provides practical examples demonstrating command usage.
  • SEE ALSO: Suggests related commands or resources.

Types of sections in Man command Manuals

The man command manuals are divided into several sections, each providing specific types of information about the commands and features of the Linux operating system. Understanding these sections helps users navigate the extensive documentation efficiently. Every manual is divided into the following sections:

  1. Executable programs or shell commands: Commands that can be executed in the shell, like ls, cd, or grep.
  2. System calls: Functions provided by the kernel, such as open, read, and write.
  3. Library calls: Functions within program libraries, like those in the C standard library, such as printf and malloc.
  4. Games: Documentation for games available on the system.
  5. Special files: Usually found in /dev, these include device files like /dev/null and /dev/sda.
  6. File formats and conventions: Details on file formats and conventions, e.g., /etc/passwd.
  7. Miscellaneous: Including macro packages and conventions, e.g., groff(7).
  8. System administration commands: Commands typically used by the root user for system administration tasks, like iptables or mount.
  9. Kernel routines: Non-standard kernel routines used within the system.

Examples of Man Command section types with Detailing

The following are the examples of man command section types with detailing:

1. Section-num in man Command in Linux

  • In the man command manuals, sections are used to categorize different types of information. You can specify a section number to display only the relevant section of a manual.

Syntax

man [SECTION-NUM] [COMMAND NAME]

Example

man 2 intro

Output

This command displays the manual entry for the intro in section 2, which pertains to system calls. Specifying a section number ensures you get the precise information you need from the extensive Linux manual pages.

man 2 intro

  • In this example, the manual pages of command ‘intro‘ are returned which lies in the section 2.

2. -f option in man Command in Linux

  • One may not be able to remember the sections in which a command is present. So this option gives the section in which the given command is present.

Syntax

man -f [COMMAND NAME]

Example

man -f ls

Output

This command lists the sections where the ls command appears, indicating that ls is documented in section 1.

man -f ls

3. -a option in man Command in Linux

  • This option helps us to display all the available intro manual pages in succession.

Syntax

man -a [COMMAND NAME]

Example

man -a intro

Output

This command will show all intro manual pages one after the other, allowing you to cycle through them to find the specific information you need. This is useful for viewing multiple sections that a command might be documented in.

man -a intro

  • The following screenshot illustrate on the manual pages of intro of section 2:

manual intro page

In this example you can move through the manual pages(sections) i.e either reading(by pressing Enter) or skipping(by pressing ctrl+D) or exiting(by pressing ctrl+C).

4. -k option in man Command in Linux

The -k option in the man command allows you to search for a command as a regular expression across all manual pages, returning a list of matching entries along with their section numbers.

Syntax

man -k [COMMAND NAME]

Example

man -k cd

Output

This command searches for the term “cd” in all manual pages and displays the relevant entries along with the sections where they are found. This is useful for finding related commands and topics within the manual pages.

man -k cd

  • The command ‘cd‘ is searched in all the manual pages by considering it as a regular expression.

5. -w option in man Command in Linux

  • The -w option in the man command returns the location of the manual page for a given command. This is useful for finding where the manual pages are stored on the system.

Syntax

man -w [COMMAND NAME]

Example

man -w ls

Output

In this example, the command man -w ls outputs the path to the manual page for the ls command, indicating where the documentation file is located on the system.

man -w ls

  • The location of command ‘ls‘ is returned.

6. -I option in man Command in Linux

The -I option in the man command makes the search case-sensitive, ensuring that the command name is considered with exact case.

Syntax

man -I [COMMAND NAME]

Example

The execution of following command helps in finding the manuals of printf command with case sensitiveness.

man -I printf

Output

This command searches for the manual pages of the printf command, treating the command name with case sensitivity. This is useful when differentiating between commands or sections that have similar names but different cases.

man -I printf

  • The following screenshot illustrates the manual of printf command with case -sensitive:

manual page for printf

  • The following looks for the manual pages for Printf command with case sensitive:

man -I printf

  • The command ‘printf’ is taken as case-sensitive i.e ‘printf’ returns the manual pages but ‘Printf’ gives error.

How to Search Manual Pages in Linux?

There are three main ways:

  1. Using the `man` command: This is the classic approach. Type `man` followed by the command name to find its manual page. For example, `man mkdir` will show you the manual page for the `mkdir` command.
  2. Using the `-k` option: Want to search for keywords across all manual pages? Use man -k followed by your keyword(s). For instance, `man -k permissions` will find pages mentioning “permissions“.
  3. Using the `apropos` command: Similar to `man -k`, but `apropos` also searches descriptions, not just names. Try `apropos networking` to find pages related to networking.

Alternative ways to read man pages

The following are the alternative ways to read man pages:

  • man2html: Converts man pages to HTML format, which can be easier to read on a graphical user interface (GUI).
  • tldr: Provides shorter, simplified versions of man pages.
  • whatis: Gives a very brief one-line summary of a command.
  • apropos: Searches the man pages for keywords and provides a list of commands and their brief descriptions.
  • info: Displays more detailed and hyperlinked documentation about commands and programs, often including more background information than man pages.

Conclusion

In this article we discussed the “man” command in Linux which is an essential tool for accessing detailed documentation on commands, utilities, and system calls. It provides a comprehensive guide with organized sections, including syntax, options, and examples. With options like -f, -k, and -a, users can quickly retrieve concise descriptions, search related commands, and access all matching manual pages.

Navigating through manual pages is simplified with common keys like Spacebar and Enter. The “man” command is not just a documentation tool; it is a valuable resource for users of all levels, contributing to a better understanding of Linux commands and enhancing command-line proficiency.



Next Article
modinfo command in Linux with Examples

A

AshwinGoel
Improve
Article Tags :
  • Linux-Unix
  • linux-command
  • Linux-misc-commands

Similar Reads

  • less command in Linux with Examples
    The 'less' command in Linux is an indispensable utility for browsing the contents of text files interactively. Unlike traditional text editors, 'less' allows you to view text files page by page without loading the entire file into memory. This approach not only speeds up the file loading process, es
    5 min read
  • let command in Linux with Examples
    The `let` command in Linux is a powerful tool used for evaluating arithmetic expressions on shell variables. It supports various operators and functionalities to perform calculations and manipulate values. Syntax of `let` command in Linux The basic syntax of the `let` is as follows. let [expression]
    3 min read
  • ln command in Linux with Examples
    The 'ln' command in Linux is a powerful utility that allows you to create links between files. These links can either be hard links or soft (symbolic) links. If you're unfamiliar with these concepts, check out our detailed guide on Hard and Soft Links in Linux to understand their differences, use ca
    3 min read
  • locate command in Linux with Examples
    locate command in Linux is used to find the files by name. There are two most widely used file-searching utilities accessible to users called to find and locate. The locate utility works better and faster than the find command counterpart because instead of searching the file system when a file sear
    7 min read
  • look command in Linux with Examples
    The look command in Linux is used to display lines that begin with a specified string. It is especially useful for searching through large files or lists, as it helps you locate entries efficiently. By default, the look command performs case-insensitive matches and searches for exact prefixes. The l
    3 min read
  • How to List All Block Devices in Linux | lsblk Command
    Understanding the storage devices connected to your Linux system is crucial for efficient system management. The 'lsblk' command, short for "list block devices," is a powerful tool that provides detailed information about block devices such as hard drives, solid-state drives, and other storage-relat
    7 min read
  • lshw command in Linux with Examples
    The 'lshw' (List Hardware) command in Linux/Unix is a powerful tool for extracting detailed information about the system's hardware configuration. This tool retrieves data from files in the '/proc' directory and is capable of reporting on a wide array of components, including memory configuration, C
    3 min read
  • lsmod command in Linux with Examples
    lsmod command is used to display the status of modules in the Linux kernel. It results in a list of loaded modules. lsmod is a trivial program which nicely formats the contents of the /proc/modules, showing what kernel modules are currently loaded. Syntax: lsmod Example: Run lsmod at the command lin
    1 min read
  • How to List Open Files in Linux | lsof Command
    In the world of Linux, understanding and managing open files is crucial for system administrators and users alike. The Linux operating system provides a powerful utility called lsof (List Open Files) that allows users to gain insights into the files currently open on their system. In this article, w
    7 min read
  • lsusb command in Linux with Examples
    The 'lsusb' command in Linux is a useful utility for displaying information about USB buses and the devices connected to them. It provides a detailed view of the USB hardware connected to your system, including details such as speed, bus number, device class, and type. This command is particularly v
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences