Upgrade Your man Pager for Better Linux Help

https://www.profitableratecpm.com/f4ffsdxe?key=39b1ebce72f3758345b2155c98e6709c

True to Linux philosophy, visualization of help pages is a team effort. Although the Man command is the one you really type, it is based on a separate tele -revenient tool to display its real content. Find out what are the implications of this system and how it can improve your help experience.

The Man command displays documentation pages for various commands, system calls, library functions, etc. He recovers this information from raw text files in the format of the man page, generally located in a directory like / usr / share / man /.

Some pages of men are short, but most are longer than a text screen. To display these pages, the Man program uses a tool called a remote retarder, a common concept through Linux.

A televerter is simply any tool that displays the content of a text file, with support to move the file a line – or a screen – at a time.

Without a tele -reverter, the man will simply empty the whole content of a man page in your terminal at a time, leaving you with the final page, which will vary depending on the size of your terminal window:

The final page of a Linux manual on the LS command.

With a remote retarder, on the other hand, the man will show you a help at the same time:

The first page of the Linux manual on the LS command. A state line at the bottom shows the current line number and the instructions to press H for help or Q to leave.

One of the great forces of Linux is its tendency to provide small targeted programs that fulfill specific functions. Using several programs together, you can perform complex tasks without dedicated software. A teleaverter embodies this philosophy: the men’s program focuses on the search for aid pages and the formatting of their text, while a teleaverter focuses on the display of the piece text by piece.

In the unusual case that you do not want at all of pagination capacity, you can use the CAT command as a tele -retarder. If your terminal application has a scrolling feature and the man’s page is not too huge, you can scroll throughout your mouse.

Linux programs often provide some ways to change their behavior, and man is no exception. The main means are:

  • Command line options.

  • Environment variables.

  • Configuration files.

Each method has its advantages, and the one you choose will generally depend on whether you want the parameter to be permanent and how much you want it to apply.

The first approach is to use a command line option. The MAN program supports an option -p to replace the remote retarder he would use otherwise:

        man -P pager

For example, to search for the LS help page, using the Pager less:

        man -P less ls

And to search for an aid for man himself, using the most sacred:

        man -P more man

You should note that Pager can be any valid command, including its own arguments and even pipes:

        man -P "grep operand | wc -l" ls

A good alternative to this command line argument is an environment variable. Linux often uses approximation for configuration, and two are relevant in this case:

  • Pager is a widely used parameter that should indicate your favorite teleaftor for general use. The support programs will kill their release via the command named in Pager.

  • Manpager replaces the sacred, especially for the Man command. Although other programs are free to use this value, you should see that only man really does. This allows you to easily specify a teleaftor for the man who differs from your general remote retarder.

You can define environmental variables for all users in / etc / environment, or for your specific user in a file like ~ / .bash_profile; This will vary depending on the shell you use.

As with any order, you can define the environment variable for a single execution by prefixing the command:

        MANPAGER=most man pwd

Finally, if your Man version supports a configuration file, you can use it to modify the remote retarder that humans are constantly using.

The Man version includes in MacOS Tahoe reads a configuration file to /and/man.conf. Ubuntu 24 comes with Man 2.12.0, which does not read a configuration file for general use.

If you have a man.conf file, the syntax to define the teleaverter is similar to the definition of an environment variable:

        MANPAGER less -s
    

In all these cases, the control of your Manpager can be a full path to an executable, or any word that your shell can treat as an order. If you want an exact version of a known program, use a full absolute path. Otherwise, use a simple control name and your shell will perform any program, function or integration applies in the current context.

The disadvantage with this approach is that it – apparently – overeating of environmental variables and the argument of the command line -P. Thus, once defined, this value is applied for each user of the system. This can, rarely, be exactly what you want, but most of the time, you will have more control if you avoid using the man’s configuration file to define the remote retarder.

Currently, you can recognize the value of a good tele -retiressor, but you are wondering which are really good – or even which remote charters are available. For such a simple tool, there are actually a surprising number of options, but you will probably use only a handful.

By default, man generally uses the less Pager, in particular this order:

        less -Sr
    

The lower program, which was published in 1984, replaces an older remote retarder named moreFrom 1978. Although an order is often available, it can be the same as that of your system, either by symbolizing or by simply being a direct copy. For example, on MacOS Tahoe, running Diff / usr / bin / less / usr / bin / Plus does not bring back any difference; The two executable binaries are identical.

The main advance that the less brought was to scroll back; Believe it or not, but the original version of More could not scroll forward. Using less, you can scroll one page at a time by pressing Spaceand a line both with Enter. Scroll through a page with B and a line both with Y.

You can also scroll through half-pages, which can facilitate your context. To use U To scroll (up) by half a page, and d To scroll forward (down) half a page.

For the pages of the man, I recommend moving by a line or a half at the same time. The scrolling of a page can be useful if you want to sail quickly, but it may make the text more difficult when you read a man page from start to finish.

most is a relatively new viewer published in 2005. Written in C, it is fast and has a small executable (125k).

The Linux Man page for the LS command indicated using the most remote retarder which includes a state line displaying keyboard shortcuts at the bottom.

Much of most can be useful in a remote retarder, but they don’t make much difference for man’s pages. The tele -retireeur window characteristics cannot be easily used with humans, and horizontal scrolling should not be necessary because man already envelops the long lines.

That said, some features can be useful. The indicator -C performs sensitive breakage, which can be useful for navigating titles in the pages of man, which are always in capital letters.

The “+ / research” argument is also very useful. Use it to scroll automatically to the first correspondence, for example:

        man -P 'most +/symbolic' ls

A sacred of more note is OV. This is a more recent version, out of 2020, and the program is written in Go, with excellent documentation. The project even explains the best use of the OV with various other tools, including humans.

OV supports an extensive set of interactive commands, which you can display at any time by pressing H:

The help for the OV televertator has displayed keyboard shortcuts for many different actions.

One of my favorite features is basic, but very useful: G to switch line numbers. Although OV shows the current line number at the bottom right, it can be easy to lose, and line numbers can help you orient yourself, especially in longer men’s pages.

Like the most sacred, OV can display more than one file at a time. But, unlike most, it can open several files from the command line, it is therefore possible to read more than a man page at a time, using the substitution of processes:

        ov <(man ls) <(man pwd)

In the OV interface, you can press ]] To go to the following file and [ for the previous one. Although it’s a little awkward to use, this feature can be handy when comparing the man pages of two similar commands. You could even use it to compare man pages for two different versions of the same command.

Where ov really shines is its configurability. An example of one small win is the –header option, which sets the number of fixed header lines:

        man -P 'ov --header 1' man

This is great for viewing man pages, since the first line is a nice header that reminds you which page you’re viewing help for:

The man page for man, viewed in the ov page, with a header line at the top.

The –header option keeps this line always in view, so you won’t get lost, even with several man pages open in different terminal windows.

Another useful option is –section-delimiter. ov lets you use this to define where sections occur in the document you’re viewing. You can then navigate between sections using Space to move forward and ^ to move backward. Since man pages have clearly defined sections, this is very useful:

        man -P 'ov --section-delimiter "^[^\s]"' man

The delimiter here is a regular expression which corresponds to the lines starting with a non -space character. Since the titles of man format of man’s pages like this, with all the other content behind by Whitespace, this carefully divides a man page into sections, with easy navigation between them.

As a bonus, you will also get section headers that remain fixed in their current section, such as a more advanced version of the Department option:

The teleaverter showing the man's page for man with section headers highlighted in purple.


Your teleaverter is usually a simple tool, so you would be forgiven not to think about it much. But more recent and OV viewers can, with a little investment, make reading pages a faster and easier task.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button