Terminal commands are the main advantage of the Linux operating system. The problem is that the user is not always able to figure out all the commands on his own. This is useful, because with the help of commands you can do much more, and importantly, much more conveniently, compared to the graphical interface. The developers have created a special help system where you can find information about any command. Most of the commands contain help pages in their packages, which are added to the common database during installation. In this article we will talk about what man is and how to use this utility.
The man command allows you to access the common help database for a command, function or program. Usually, to view help, the program needs to be passed the name of a command or other object in the system. Its syntax is as follows:
$ man раздел page_name
Typically, the page title is the name of the command or the name of the program. The whole help is divided into several sections. By default, help pages are output from all sections, but the user can output help pages from a specific section. To do this, just pass the section number to the command.
Here is a list of the main sections:
Now let's look at some examples. To see the man command help, just run the following command:
$ man man
To invoke ls
help:
$ man ls
The individual help page is divided into several sections.
These are:
There are other sections as well, but these are the main ones. If there is not much information about the utility, some sections may be combined together, and some may not exist at all.
The following hotkeys are used to view information and manage the help page:
e
or j
- move up one line;y
or h
- move one line down;z
- move one window down;w
- move one window up;d
- move half a window down;u
- move half a window up;/
- search for occurrences of the specified after characters forward;?
- the same as the previous one, only search backwards;n
- in the search mode display the next occurrence;N
- in the search mode display the previous occurrence.Then press Enter and the program will highlight all occurrences of this word in the text. To search for the next occurrence press n
.
These keys will be enough for you to use the help. The less utility is used for outputting information, so if you need more hotkeys.
There are several options you can use when running the utility, let's take a look at these options. There are not that many and the most interesting ones are only a few. The -f
option allows you to see a brief description of the help page. For example
$ man -f ls
With the -k
option, you can search the brief descriptions of the help pages. For example, let's find all pages that have the word printf
in their descriptions:
$ man -k printf
The -K
option allows you to search the reference pages themselves. The search is performed by brute force, so it takes some time:
$ man -K core
The command will open all found pages. To enter, press Ctrl+C. The -L
option will allow you to manually set the language in which the page will be displayed. To display information about man in English, run:
$ man -L en_US man
To display man in Russian Linux you need to set this option to ru_RU:
$ man -L ru_RU man
To make this work, you need to have Russian localization packages installed on your system.
Other options can always be found in the help page for the man command.