HomeLinuxHow you can Navigate Man Pages Effectively in Linux

How you can Navigate Man Pages Effectively in Linux


Good documentation is totally needed for any software program, and this precept extends to Linux instructions as effectively.

Quite a few Linux distributions and open-source communities supply complete documentation that’s readily accessible on the Web.

This documentation supplies in-depth data, directions, and explanations about Linux instructions, guaranteeing that customers have the assets they should successfully make the most of and perceive the command-line instruments obtainable to them.

Nevertheless, there are situations the place concise documentation is satisfactory for swiftly undertaking a particular job. In such conditions, we are able to depend on the in-built system documentation accessible by the “man” command.

The “man” command is a shortened type of “handbook” and serves as an interface to entry the system’s reference manuals. These manuals, often known as “man pages” include detailed documentation for particular person instructions.

For instance, the person pages of instructions comparable to mkdir, rmdir, dd, and others present detailed documentation on their respective functionalities and utilization.

$ man mkdir
$ man rmdir
$ man dd

One needs to be acquainted with the “man” command to effectively use Linux from the terminal.

man Command Syntax

The syntax of the man command is simple:

$ man [OPTIONS] ...   ...

Identical to another Linux command, the pair of sq. brackets ([]) represents the non-compulsory argument whereas the pair of angular brackets (<>) represents the obligatory argument.

Sections of the person Command

Other than shell instructions, Linux additionally helps different programming constructs comparable to system calls, library calls, particular recordsdata, and so forth. For higher group, every programming assemble is clubbed below a devoted group known as sections.

So let’s talk about every man part briefly:

  • Part 1 – This part accommodates man pages of executable applications or shell instructions. For instance, reduce, gzip, uniq, and so forth.
  • Part 2 – This part accommodates man pages of system calls. A system name is utilized by the Linux kernel to reveal its performance. The widespread system calls are – open(), learn(), write(), shut(), lseek(), and so forth.
  • Part 3 – This part accommodates man pages of library calls. Library calls are the features supplied by the consumer area libraries. For instance, strlen() operate from the string library, fopen() operate from the normal enter/output library, and so forth.
  • Part 4 – This part accommodates man pages of the particular recordsdata. Often, these recordsdata are current below the /dev listing. For instance, /dev/null, /dev/full, and so forth.
  • Part 5 – This part accommodates man pages of the file codecs and conventions. For instance, /and so forth/hosts, /and so forth/shadow, and so forth.
  • Part 6 – This part accommodates games-related man pages.
  • Part 7 – This part accommodates man pages of the miscellaneous instructions. For instance, man and groff.

On this newbie’s information, we are going to delve into the intricacies of the “man” command, gaining in-depth data by sensible examples.

1. View Man Web page of Linux Command

One of many main use of the man command is to show the system documentation. The legitimate argument for the person command is the identify of this system, utility, or operate.

To grasp this, let’s use the next command to view the person web page of the sleep command.

$ man sleep
View Linux Command Man Page
View Linux Command Man Web page

Within the above output, we are able to see that the man command exhibits detailed details about the sleep command. We will press the 'q' key to stop the person web page window and return again to the terminal.

In the event you observe rigorously, then we are able to see that on the highest left and proper corners, there’s a quantity enclosed within the parentheses after the command identify. That quantity represents the part of the person web page.

For instance, within the above output, SLEEP(1) is used to symbolize part 1 of the person web page.

2. Navigate By a Man Web page

Every man web page supplies exhaustive data. For instance, the outline of the command with all supported choices, exit codes, creator of the command, identified points/bugs, and so forth.

Such detailed data can’t be displayed on a single terminal window therefore by default the man command makes use of the pager utility known as much less.

We will use the next pager instructions to navigate by the person web page effectively:

  • Up arrow – to maneuver ahead in a person web page by one line.
  • Down arrow – to maneuver backward in a person web page by one line.
  • f or area – to maneuver ahead in a person web page by one terminal window.
  • b – to maneuver backward in a person web page by one terminal window.
  • /sample – to seek for a sample in a person web page in a ahead path.
  • ?sample – to seek for a sample in a person web page in a backward path.

3. View Man Web page from a Particular Part

Many Linux instructions are named after the system calls or library features. For instance, chown is a Linux command in addition to a system name. Equally, sleep is a Linux command in addition to a library operate.

By default, the man command searches for the documentation in all sections and exhibits the web page from the primary matched part.

For instance, within the earlier instance, the command – man sleep exhibits the person web page from part 1 solely even when the person web page is current in part 3 as effectively. In such instances, we are able to use specify the part quantity as a command line argument to the man command.

Now, let’s view the person web page of the sleep() library operate utilizing the next command:

$ man 3 sleep

Within the above command, the quantity 3 after the person command represents part 3.

View Man Page of Specific Section
View Man Web page of Particular Part

4. View Man Web page from All Sections

Within the earlier examples, we noticed view a person web page from the default in addition to the precise part. Nevertheless, typically we don’t know the opposite sections wherein the person web page is on the market.

In such instances, we are able to use the -a possibility with the command to view man pages from all sections.

$ man -a sleep

With this feature, the person command exhibits all man pages one after the other. Therefore to view the subsequent man web page now we have to stop the present man web page by urgent the ‘q’ key.

For instance, the next on-screen directions are displayed after urgent the 'q' key.

View Man Page of All Sections
View the Man Web page of All Sections

5. Search Sections Of Man Web page

Within the earlier instance, we noticed view the person pages from all sections. Nevertheless, typically we simply need to know the sections wherein the actual man web page is on the market.

In such instances, we are able to use the -f possibility to point out the part of the person web page together with the quick description.

$ man -f sleep
Search Sections of Man Page
Search Sections of Man Web page

Within the above output, we are able to see the concise details about sleep from sections 3 and 1 respectively.

6. Search Man Pages by Key phrase

Generally, we need to seek for a specific key phrase within the description of the person web page. In such instances, we are able to use the -k possibility, which lists the person pages by key phrase.

Now, let’s record all man pages wherein the phrase sleep is current:

$ man -k sleep
Search Man Pages by Keyword
Search Man Pages by Key phrase

7. Discover Supply Location of Man Web page

A person web page is a plain textual content file that’s compressed utilizing the gzip command, utilizing the -w possibility will print the placement of man web page file.

$ man -a -w sleep

/usr/share/man/man1/sleep.1.gz
/usr/share/man/man3/sleep.3.gz

Within the above output, we are able to see that the person web page file from part 1 is current below the /usr/share/man/man1 listing. Equally, the person web page file from part 3 is current below the /usr/share/man/man3 listing.

8. View Man Web page in GNOME Assist Browser

Thus far, we displayed all man pages on the terminal solely. Nevertheless, we are able to additionally view them within the GNOME assist browser as effectively by utilizing the yelp command.

$ yelp man:sleep
View Man Page in Gnome Help
View Man Web page in Gnome Assist

It’s vital to notice that, this technique is beneficial provided that the GNOME Desktop GUI is on the market.

9. View Man Web page in Internet Browser

Along with this, we are able to additionally use the -H choice to view the person web page in a internet browser comparable to Firefox browser.

$ man -Hfirefox sleep
View Man Page in Browser
View Man Web page in Browser

On some techniques, we’d get the error:

man: command exited with standing 3: (cd /tmp/hmanQf1PgM && /usr/lib/man-db/zsoelim) | (cd /tmp/hmanQf1PgM && /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE) | (cd /tmp/hmanQf1PgM && preconv -e UTF-8) | (cd /tmp/hmanQf1PgM && tbl) | (cd /tmp/hmanQf1PgM && groff -mandoc -Thtml)

To repair this error, now we have to put in the groff utility, which is a typesetting system that’s generally used for formatting and processing plain textual content paperwork.

$ sudo apt set up groff         [On Debian, Ubuntu and Mint]
$ sudo yum set up groff         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
$ sudo emerge -a sys-apps/groff  [On Gentoo Linux]
$ sudo apk add groff             [On Alpine Linux]
$ sudo pacman -S groff           [On Arch Linux]
$ sudo zypper set up groff      [On OpenSUSE]    
Conclusion

On this information, now we have mentioned view Linux system documentation. We now have explored the utilization of the “man” command to show system documentation each on the terminal and inside UI instruments.

Have you learnt of another method to entry the Linux system documentation? Tell us your views within the feedback beneath.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments