Cantech Knowledge Base

Your Go-To Hosting Resource

How to Read Manual Pages in Linux Using the man Command?

The man command in the Linux system offers detailed and manual pages for multiple commands, functions and utilities. It helps users to access complete information on command’s usage, syntax and options. This tool serves as an important resource for understanding and effectively using the system commands.

In this blog we will explain to you how to use the man command in Linux. Let’s get started

man Command Syntax

Here is the basic command syntax of man

man [option] command_name

Add command_name in the above command to view its manual page.

Syntax Description
man [command_name] Displays manual page for the specified command. For example, man ls shows the manual for the ls command.
man [section] [command_name] Retrieves the manual page from a specific section. For example, man 5 passwd displays the manual for the passwd file format.
man -k [keyword] Does the Search for manual page descriptions for the specified keyword. For example, man -k copy lists all commands related to “copy”.
man -f [command_name] Gives a short description of the specified command. For instance, man -f bash gives a brief overview of the bash command.
man -a [command_name] Displays all manual pages which match the command name. For example, man -a printf shows all manual entries for printf.
man -w [command_name] Shows location of the manual page file for the specified command. For example, man -w ls displays the path to the ls manual page.
man -c [command_name] Enables the reformatting of the manual page, ignoring any cached versions. For example, man -c ls reformats and displays the ls manual.
man -P [pager] [command_name] Uses the specified pager to display the manual page. For instance, man -P more ls uses the more pager to show the ls manual.

Examples of man Command

To display the specific command’s manual page.

man ls

Output

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 ..

       -l     use a long listing format

       -h, --human-readable
              with -l and -s, print sizes like 1K 234M 2G etc.

       -S     sort by file size, largest first

       -t     sort by modification time, newest first

       -r, --reverse
              reverse order while sorting

       -R, --recursive
              list subdirectories recursively

       -F, --classify
              append indicator (one of */=>@|) to entries

       --color[=WHEN]
              colorize the output; WHEN can be 'always', 'auto', or 'never'

       --help display this help and exit

       --version
              output version information and exit

The output of man ls might vary slightly depending on the Linux distribution, but a typical output looks like this.

Search for a command by using a specific keyword

man -k copy

Output

bcopy (3)            - copy byte sequence
cp (1)               - copy files and directories
clone (2)            - create a child process (copy process image)
copy_file_range (2)  - copy a range of data from one file to another
dd (1)               - convert and copy a file
install (1)          - copy files and set attributes
memcpy (3)           - copy memory area
scp (1)              - secure copy (remote file copy program)
strcpy (3)           - copy a string
strncpy (3)          - copy a fixed-size string

Display titles of manual page

man -f ls

Output

ls (1) - list directory contents

View all the manual pages

man -a intro

Output

INTRO(1)                User Commands                INTRO(1)

NAME
       intro - introduction to user commands

DESCRIPTION
       Section 1 of the manual contains commands that can be executed by users.

       For a list of commands, type:
           man -k .

To display the location of manual page files

man -w ls

Output

/usr/share/man/man1/ls.1.gz

Add man with a custom pager command

man -P cat ls

Output

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 ..

       -l     use a long listing format

       -h, --human-readable
              with -l and -s, print sizes like 1K 234M 2G etc.

       -S     sort by file size, largest first

       -t     sort by modification time, newest first

       -r, --reverse
              reverse order while sorting

       -R, --recursive
              list subdirectories recursively

       -F, --classify
              append indicator (one of */=>@|) to entries

       --color[=WHEN]
              colorize the output; WHEN can be 'always', 'auto', or 'never'

       --help display this help and exit

       --version
              output version information and exit

Output may vary

Mention a manual page section to look for a specific command.

man 7 passwd

Output

PASSWD(7)                           Linux Programmer's Manual                           PASSWD(7)

NAME
       passwd - password file format

DESCRIPTION
       The  /etc/passwd  file  is  a  text  file  that  describes  user  login  accounts.   It contains one line per user, with fields separated by colons (:). Each line has the following format:

              username:password:UID:GID:GECOS:home_directory:shell

       The fields are:
       - username:        User's login name.
       - password:        Encrypted password or 'x' if stored in /etc/shadow.
       - UID:             User ID (unique numeric identifier).
       - GID:             Group ID (primary group ID).
       - GECOS:           Optional user information (e.g., full name).
       - home_directory:  Path to the user's home directory.
       - shell:           User's default shell (e.g., /bin/bash).

       The /etc/passwd file is readable by all users but writable only by root.

FILES
       /etc/passwd  - user account information.

SEE ALSO
       passwd(1), shadow(5), getpwnam(3), useradd(8)

COLOPHON
       This page is part of the Linux man-pages project. A description of the
       project, information about reporting bugs, and the latest version of this page
       can be found at https://www.kernel.org/doc/man-pages/.

Linux                                       2024                                      PASSWD(7)

Shortcut Keys to Navigate Manual Pages

Key Action
Up / Down Scroll line by line.
Spacebar Scroll down on one screen at a time.
b Scroll up on one screen at a time.
g Go to the beginning of the manual page.
G Go to the end of the manual page.
q Quit manual page.
n Repeat the last search in the same direction.
N Repeat the last search in the opposite direction.
/pattern Search forward for a pattern.
?pattern Search reverse for a pattern.
Enter Scroll down on one line at a time.
k Scroll up one line at a time.

Manual Page Sections

The man command in Linux helps organize the manual pages into sections based on the type of file or command that will be documented. Each section is identified by a number.

Section Description
1 User Commands
2 System Calls
3 Library Functions
4 Special Files 
5 File Formats & Configuration Files
6 Games & Screensavers 
7 Miscellaneous 
8 System Administration Commands
9 Kernel Routines 

Conclusion

You can execute the man man to view the command’s manual page for detailed information about the man command.

March 24, 2025