[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 13, 2023

How to use man command in Linux.

How To Use Man Command.

The man command is a built-in manual for using Linux commands. It allows users to view the reference manuals of a command or utility run in the terminal. The man page (short for manual page) includes a command description, applicable options, flags, examples, and other informative sections.

Prerequisites

  • A machine running Linux

  • Access to the command line

  • An account with root privileges

 

Linux man Command Syntax

The basic man command syntax is:

man [option] [section number] [command name]
  • option – the search result output.

  • section number – the section in which to look for the man page.

  • command name – the name of the command which man page you want to see.

By default, man looks in all the available sections of the manual and shows the first match (even if the page exists in several sections). Providing a section number instructs the man command to look in a specific section.

There are nine sections of the manual:

  • General commands: Commands used in the terminal.

  • System calls: Functions the kernel provides.

  • Library functions: Functions in program libraries.

  • Special files: Usually devices found in /dev and related drivers.

  • File formats and conventions: File formats like etc/passwd.

  • Games: Descriptions of commands that display database quotes.

  • Miscellaneous: Various descriptions, including macro packages and conventions, boot parameters, and others.

  • System administration commands: Commands mostly reserved for root.

  • Kernel Routines: Information about internal kernel operations.

 

How to Use man in Linux

In the terminal window, type man followed by the Linux command name which man page you want to see.

The output is lengthy. Use the mouse scroll wheel, the up and down arrow keys, or the PgDn and PgUp keys to navigate through it.

After running the man command, press H to see the help section and a table of possible keystrokes for navigating the output.

To exit, press Q.

The output of the command displays the available man page headings for the specified command.

The list of possible headings includes:

  • Name: The name of the command.

  • Synopsis: The command’s syntax.

  • Configuration: Configuration details for a device.

  • Description: A description of the command.

  • Examples: Several examples demonstrating the use of the command.

  • Defaults: The default functions of the command and how they can be overridden.

  • Options: A list of options and flags that the command accepts.

  • Exit Status: A list of possible exit status values for the command.

  • Environment: A list and description of environment variables that affect the command.

  • Files: A list of files used by the command.

  • See also: Commands related to the described topic.

  • Authors: The people who wrote or maintain the command.

  • History: Command development history.

  • Notes: Various notes, including permissions required, dependencies, etc.

  • Bugs: Any known issues in this program version.

 

Look for man Pages

The -f option displays all man pages that match the specified command name and states the sections in which the given command is present.

Use the following syntax:

man -f [command name]

The output is a list of results that match the search criteria. With multiple matches, the number next to the search result indicates the section.

 

Display man Pages From Specific Sections

To display the page from a specific section of a manual, use the syntax:

man [section number] [command name]

For example:

man 3 sleep

 

Display man Pages in a Browser

Man pages are long and sometimes difficult to scroll through to find the information you need. The man command allows users to display man pages in a browser to find information easily.

To do so, follow these steps:

  1. Make sure the

groff package is installed. Run:

sudo apt-get install groff
  1. Before calling the

man command, select a default browser. Run:

export BROWSER=firefox

To use a different browser, replace firefox with google-chrome, chromium-browser, or any other browser.

  1. Use the

-H option to read the man page in a browser of your choice:

man -Hfirefox vmstat

The -H option instructs groff to produce an HTML output and displays that output in a browser.

 

Display man Pages and Print Short Descriptions

The -f option allows users to look up the man pages and prints out short descriptions of the specified command in the terminal. The syntax is:

man -f [command name]

 

Display All man Pages

The -a attribute allows users to display all available intro manual pages contained in each section, one at a time.

man -a [command name]

Quit between successive displays or skip through them using Ctrl+C or Ctrl+D, respectively.

 

Search by Considering Input as a Regular Expression

The -k option allows users to search the short command descriptions and manual page names for a specified keyword as a regular expression. The output shows any available matches.

The syntax is:

man -k [command name]

 

Display Location of man Pages

The -w attribute shows the location of the manual page of the specified command. Adding the -a option prints out the locations of all files matching the keyword.

The syntax is:

man -w [command name]

In this example, we used the -a option to see the locations of all associated man pages.

Additionally, using the -W option displays the location of the preformatted cat file. With the -a option, it prints out the locations of all preformatted cat files matching the keyword.

 

Enable Case-Sensitivity

To search for manual pages using case-sensitivity, use the -I option. The syntax is:

man -I [command name]

The man default setting is to ignore case when looking up manual pages. To go back to default settings and ignore case, use the -i option.

 

Conclusion

You now know how to use the man command in Linux. Use the command to see user manuals for Linux commands, search for a specific keyword, or see all the entries in the manual.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, colocation, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM