Searching through the seemingly endless repository of information online has been, and always will be, a useful tool in the pocket of any sysadmin. The vast archive of collective wisdom and shared experiences is a tribute to The Open Internet. Having access to such a huge repository of information is not something any sysadmin takes for granted. That said, there are certainly advantages to knowing how one can find answers to a problem without having to rely on the World Wide Web for every question or problem. For one, you might find yourself working in an air-gapped environment in which access to the Internet isn't possible. Or, if you have ever sat a Red Hat exam, you're aware that access to the Internet is also not an option, and knowing how to look things up fast may mean the difference between a pass and no pass result.
[ You might also like: 6 options for tcpdump you need to know ]
This leads me to the topic of this article, the man command, which I believe is one of the simplest yet most important commands available to any sysadmin. Why? Because in many cases, it's the first step toward finding the solution to a problem. And knowing how best to leverage the man command might accelerate finding an answer.
Before I jump into my top five options for man, it’s important to mention that man pages are divided up into several sections based on areas that they cover:
- 1 - Executable programs or shell commands
- 2 - System calls (functions provided by the kernel)
- 3 - Library calls (functions within program libraries)
- 4 - Special files (usually found in /dev)
- 5 - File formats and conventions, e.g. /etc/passwd
- 6 - Games
- 7 - Miscellaneous (including macro packages and conventions), e.g., man(7), groff(7)
- 8 - System administration commands (usually only for root)
- 9 - Kernel routines [Non-standard]
Being aware of these sections may help you when trying to narrow down your search criteria. The above table was pulled straight from man's own man page, which you can view with the command man man.
Now, on to my top five options.
Top five options
Here are my favorite options for the man command. These will help you get the most from this simple but powerful command.
List all available man pages on the system and provide a short description.
$ man -k .
Output a short description of the specified man page. Keyword must be the exact name of a man page.
$ man -f <keyword>
Example: man -f virt-manager
Search through all man pages using regular expressions and open the matching man pages one after the other. This works well when combined with the -wK options described below.
$ man --regex <keyword>
Example: man --regex ".*network$"
This is good for narrowing down the search criteria to specific sections. Multiple sections can be defined as comma-separated-values, and this option also works best when combined with --regex.
$ man -S <section ID> <keyword>
Example: man -S 1 --regex "^virsh"
This is my personal favorite. Use this to search through all man pages on a system for the specified keyword and output the location of any man pages that contain that keyword. Powerful when used with --regex.
$ man -wK <keyword>
Example: man -wK --regex "ipv4.*listen"
Wrap up
Often, the answer to a question is hiding in the documentation that already exists on your system. Understanding the tools at your disposal is key to reaching a speedy resolution and the man command is one of those tools that can help you get there.
À propos de l'auteur
Thomas is a Technical Account Manager for Red Hat. An Aussie expat in Sweden, he is passionate about Open Source software and has a keen interest in emerging technologies such as blockchain. Always looking to discover something (or somewhere) new, Thomas prefers to either be travelling or working on a project. More recently he has combined these passions into an ongoing van conversion project, featuring IoT connectivity built on top of Raspberry Pi's with Open Source software!
Plus de résultats similaires
Behind the scenes of RHEL 10, part 3
Alliander modernises its electricity grid with Red Hat for long-term reliability in balance with rapid innovation
The Overlooked Operating System | Compiler: Stack/Unstuck
Linux, Shadowman, And Open Source Spirit | Compiler
Parcourir par canal
Automatisation
Les dernières nouveautés en matière d'automatisation informatique pour les technologies, les équipes et les environnements
Intelligence artificielle
Actualité sur les plateformes qui permettent aux clients d'exécuter des charges de travail d'IA sur tout type d'environnement
Cloud hybride ouvert
Découvrez comment créer un avenir flexible grâce au cloud hybride
Sécurité
Les dernières actualités sur la façon dont nous réduisons les risques dans tous les environnements et technologies
Edge computing
Actualité sur les plateformes qui simplifient les opérations en périphérie
Infrastructure
Les dernières nouveautés sur la plateforme Linux d'entreprise leader au monde
Applications
À l’intérieur de nos solutions aux défis d’application les plus difficiles
Virtualisation
L'avenir de la virtualisation d'entreprise pour vos charges de travail sur site ou sur le cloud