What is man command in linux

What is Man Page in Linux? [Structure, Sections & Examples]

The Man Pages are among the vital features of Linux distributions. These are basically manual documents for the Linux commands. Most of the Linux commands come with a corresponding man page. In this article, you will get to know what is Man Page as well as its structure and sections in Linux.

What is Man Page in Linux?

The man page in Linux is an abbreviation for “Manual Page. It refers to the manual documentation of the Linux commands or programs. In the Linux operating system, you can interact with the system by typing commands in the CLI ( Command Line Interface), a terminal emulator. A man page provides detailed instructions on the syntax and usage of these commands. Users can invoke the man page of a command by writing the man command itself. By default, it displays a conventionally structured manual of a command in the system’s terminal.

The “man” Command in Linux

The man command is used to view the man page of a particular command. It displays the list of options, arguments, command syntax, and applications. Moreover, the man command itself also comes with a specific syntax and several options. Below you will find some basic information about the man command.

A. Syntax

The syntax of the man command in Linux is quite simple. It simply takes a command as input and shows information about that command.

man [man options] [[section] page . ] …

Note: In the above syntax the terms enclosed by square brackets indicate that these are not mandatory. The 3 dots represent that multiple sections can be utilized at the same time.

B. Options

Multiple options are available for the man command in Linux. Some of the most used options are listed here. These options can be found on the generated man page of the man command by typing the following:

Читайте также:  Symbolic linking in linux

The man page of the man command.

The output of the man man command is as shown below. The options found on this man page are as follows.

  • SECTION COMMAND: Shows the specific SECTION of a COMMAND.
  • -k KEYWORD: Searches for the KEYWORD in the whole manual page and shows all the matches.
  • -f KEYWORD: Looks for a short description of any KEYWORD or Command.
  • -d, –default: Resets the man command behavior to default.
  • -i, –ignore-case: Ignores case sensitivity of the command.
  • -I, –match-case: Looks inside the man page with case sensitivity.
  • -a, –all: Shows all manual pages that match the specific keyword or command.

Note: The options in Linux CLI (Command Line Interface) are all case-sensitive, So be cautious while using them.

Structure of Man Page

The man page follows a conventional structure for the documentation of the commands. Because viewing command descriptions in a certain structure makes this man page convenient for the users. Below you will find the details on man page structure.

  • NAME: Displays corresponding command name.
  • SYNOPSIS: The syntax of the command.
  • DESCRIPTION: A short description of the command.
  • EXAMPLES: Provides examples of complex command applications.
  • DIAGNOSTICS: Gives the possible error messages or status returned by the command.
  • FILES: Lists the supplementary files needed to run the command.
  • LIMITS: Describes the limitations of the command utility.
  • PORTABILITY: Provides a list of other compatible systems for the utility.
  • SEE ALSO: Gives a list of related man pages.
  • HISTORY WARNING (or Bugs): Provides warnings and advice for users.
  • NOTES: Other important information.

Man Page Sections

In Linux, man pages are divided into 9 sections to make it easier to find useful information. Each of these sections describes a specific topic.

  • 1. User commands: Describes user commands and tools such as shells, compilers, editors, etc.
  • 2. System calls: Describes system calls which is an entry point into the kernel and similar to invoking a library function.
  • 3. Library functions: Explains all library functions except for the ones included in system calls.
  • 4. Special files: Contains man pages for special files such as device and configuration files etc.
  • 5. File formats and conventions: Provides the file formats, conventions and protocols used by the system.
  • 6. Games: Describes all the installed games and fun programs.
  • 7. Miscellaneous: Gives an overview of various topics including standards, layout, conventions, protocol, etc.
  • 8. System administration commands: Includes man pages for commands that are used by system administrators.
  • 9. Kernel routines: Contains man pages for Kernel routines that are typically accessed by the kernel developers.
Читайте также:  Network is unreachable kali linux

How to View a Man Page in Linux

The main objective of the man page is to provide user-friendly command documentation. Therefore, the Linux distribution offers multiple ways to view the available man pages and extract necessary information. Furthermore, users can view a command-specific man page as well as filter the pages depending on the available sections. In this section, I have described multiple ways to view man pages in Linux.

A. Viewing the Man Page of a Specific Command

Finding a specific man page is the main function of the man command. Therefore, you must follow the given syntax to get a command-specific man page.

In this example, I will show you the man page of the ls command. You can follow the steps given below to do the same.

Steps to Follow:

❶ Open the Terminal.

❷ Type the following command.

❸ Now, press the ENTER key.

Note: To get out of the man page, you need to press the Q key from the keyboard.

Viewing Man Page of a Specific Command.

In the image below, you can see that the man page for the ls command is shown.

B. Viewing a Particular Section of a Command from the Man Page

You can see the particular sections from the man page. To do so you must follow the general syntax below.

Not all commands have different sections. The man command itself has two sections: section 1 and section 7. In this example, I will filter section 7 of the man command. To get the same results, follow the steps below.

Steps to Follow:

❶ Launch the Ubuntu Terminal.

❷ Type either of the following commands in the command line.

Viewing Particular Section of a Command from Man Page.

In the following image, you can see that I have displayed section 7 of the man page.

C. Displaying All the Man Pages of Different Sections

Some commands have many sections and you may want to view all of these sections one after another. In that case, you need to use the -a option to view all the different man pages of the particular command. However, the general syntax is as follows.

In this example, I will list all the different sections of the intro command. You can do the same by following the steps mentioned below.

Читайте также:  Gnu grub запуск linux

Steps to Follow:

❶ Go to the ubuntu Terminal.

❷ Type either of the following commands in the command line.

❸ Press ENTER to get inside the man page of the first section of the intro command.

❹ Hit Q to quit this section.

❺ Now, press CTRL+D to list the next section, or, press CTRL+C to quit the command.

❻ Again, press the ENTER key to get inside the recently listed section.

In the 1st image, you can see that the command by default shows section 1 of the intro command.Showing the section 1 of the intro command.Moreover, in this second image, you can see that a list of all available sections is listed for the command.Displaying All the Man Pages of Different Sections.

Conclusion

In this article, I have described the prime objectives and functions of the Man Page in Linux. It is one of the features that make Linux distributions user-friendly. You will be able to learn about useful commands solely from the Man Page. Here, I have also demonstrated the structure and sections of the page for your better understanding. I hope knowing this Linux feature aids your journey with the command line and makes you a power user.

Similar Readings

Источник

what is man command in linux?

what is man command in linux?

Man Command Provide the user manual Interface. This Interface Help To Read Manual Page references of Any Command Inside Your Terminal.

Syntax

Output in your cmd Tool

  • Press q inside your terminal. You Quit The Command And Return.
  • Press h Read Summary of Commands

Options

man -w

This Flag Doesn’t display any manual pages but prints the locations Of Command, Which Place Save Inside Your Laptop.

Output man Command result

man -f or man —whatis

This Flag Show You a short description from the manual page if a Description is available.

Output man Command option result

man man

this way, You Read also man Command Manual Page Information.

man Command Output

man —help

This Flag Provides You help page document About man Command.

man Command Output with --help flag

man —usage

This Flag gives you a short usage message about the Command.

man Command Output with --usage flag

man -V or man —version

This Flag print man Command version In You Terminal.

man command output version

Note

  • Man Command Provide Lots Off option We Recommend You Visit Command Man Page for Learn More
  • Quit man Command simple use q for quit or Exit Command.use Keyboard arrow keys use For Scroll Page up for page up↑ and down for page down↓ keys.

Источник

Оцените статью
Adblock
detector