IBM has released quite a few big hitters lately, MariaDB etc., and some of the not so well known utilites have slipped under the cover.
Let me take you through one of them in this article.
This great utility stops you being told to RTFM (Read the manual)!
So this is where this open source offering comes to the forefront.
Man-DB (Short for manual) is used to format and display the user manual of any command that we can run in a shell terminal.
It is an interface to the system reference manuals.
It is particually useful for finding out the syntax of command, or the layout of any configuration files.
A real hidden secret this one.
All available manual pages are separated into sections.
To make things simpler, the man command lets you directly access manual pages from specific sections. We can just specifying the section number before the command/tool name.
How do we install it?
Like all the open-source offerings made available by IBM, installation is easy, by using either the Access for Client Solutions (ACS) or using Yum.
Once again, I will use Yum to install these packages.
yum install man-db
No dependencies for this one – that makes a change!
How do we use it?
Nice and easy, each man-db command starts with man, could not have been anything else really! Let us look at what man says about man, from our shell session, by typing the following command.
The syntax of man is, type in ‘man command’ or ‘man section command’
Let me start with a simple example.
To get the manual for the echo command, type man echo
Note the start and the end of each manuals section. In the figure above. The screen shows that we are in the echo manual for section 1, programs or shell commands.
There are man pages for commands, programs and programming functions, but you do not see all of these headings on every page, because some of them only apply to certain types of commands.
Each section relates to different types of information, in a manual. These sections are explained in the table below.
|1||Programs or shell commands|
|5||File formats and conventions|
|8||System administration commands|
Navigation around the man pages is performed with shortcut keys.
Use the table below as a reference guide.
|E||Forward one line|
|Y||Backward one line|
|F||Forward one window|
|B||Backward one window|
There are other shortcuts, which can be found by using the h (help) key.
Search the Manuals
Let’s move onto something a bit more involved.
We can use man’s -k switch to search for a string in all the manuals on the system.
For example, if we want to search all the manuals for occurrences of node, we will enter,
man -k node
this returns the following figure.
Here we can see that node is referenced in the following manuals where there are library calls (section 3).
Let me choose one of these OpenSSL manuals.
which states there is even further information that can be found about library calls (section 3) of OPENSSL_LH_COMPFUNC and a BIO miscellaneous (section 7) entry.
Man is an extremely important command that users, both newbies and us older ones, should know how to use.
It is worth looking at man-db, even with commands you think you know well, it is a safe bet there are other options you have never heard of.
While we are talking open-source, join me at the next i-UG UK user group meeting in March, where I will be adding my two bobs-worth on open source on IBM i.
If you have any questions, either on this article, or anything else open source, use the comments below, or send me a message on twitter @AndyYouens
Andy Youens is an IBM i consultant/instructor at Milton Keynes, UK-based FormaServe Systems with over 40 years IBM midrange experience.
IBM Champion 2021