Linux man Command: How to Read and Search Manual Pages

In Linux, using the man command allows you to view the manual pages of installed commands and system functions. For example, running man ls allows you to read the usage and options of ls, and generally, you can press q to exit the screen.

Opening a manual page

man stands for manual and helps find and display manual pages installed on the system. In addition to programs, there are pages related to configuration file formats, system calls, and library functions. For example, the following command opens the manual for ls.

man ls

Manuals usually include the name and a short description in NAME, the command format in SYNOPSIS, and functions and options in DESCRIPTION and OPTIONS. The contents and section headings may vary for each program. Reading the manual does not execute the described commands or change system settings.

Screen Navigation and Search

man uses a paging program to display long content one page at a time. The instructions below are based on the commonly used less. If a different program is set, the keys may differ.

  • Down/Up Arrow: Move one line at a time.
  • Space or Page Down: Move down one screen. b or Page Up moves up one screen.
  • / followed by a search term and Enter: Search forward from the current position. n moves to the next result in the same direction, N moves to the result in the opposite direction.
  • g and G: Move to the beginning and end of the document, respectively. Case sensitive.
  • h and q: h opens the operation help, and q exits the help or manual screen.

For example, if you enter /sort on the man ls screen and press Enter, it searches forward for that expression. The search term is entered within the manual screen, not as a shell command. For detailed keys and search rules, refer to the less manual.

Selecting manual sections with the same name

Manuals are divided into numbered sections according to topics. If a page name exists in multiple sections, you can specify a number to open the desired page. For example, passwd is used both for user password-related commands and for the names of account information files.

man 1 passwd
man 5 passwd

The first command finds the manual for the command, and the second finds the manual for the file format. The corresponding page must be installed on the system to be displayed. If the number is omitted, the page that is first found according to the configured search order will be opened.

  • 1: General commands and executable programs
  • 2: System calls
  • 3: Library functions
  • 5: File formats and rules
  • 8: System Management Commands

The notation passwd(5) indicates the page name and section number. The complete sections and search methods can be found in the man manual.

Finding a page by name or topic

If you do not know the exact command name, you can search for the manual name and a short description using man -k. The following example finds items related to password.

man -k password

The results will display the page name, section number, and a short description. The search terms can be interpreted as regular expressions, and this search does not cover the entire manual text. Found items can be opened like man 5 passwd using the name and section number.

If you already know the name and only want to see the short description, run it as follows.

man -f ls

man -k and man -f use the manual index, so results may vary depending on the installed documents or index status.

When the manual cannot be found

  • Page not found: Check the spelling of the name and verify whether the program and the associated document package are installed. The manual may be missing in a minimal installation environment.
  • Built-in commands: Commands built into the shell, like cd, may not have separate pages. In Bash, you can check help cd or man bash.
  • No search results: Make sure the documentation is installed and the manual index is prepared. To regenerate the index and manage permissions, follow the distribution's documentation.
  • Different language: Depending on the installed translation and locale settings, it may appear in English. Verify options and examples based on the documentation for the installed software version.

If you need a simple help provided by the command itself, you can also check the --help option of that program. The usage of man itself can be seen in man man.