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.
Sull'autore
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!
Altri risultati simili a questo
More than meets the eye: Behind the scenes of Red Hat Enterprise Linux 10 (Part 6)
Red Hat Enterprise Linux now available on the AWS European Sovereign Cloud
The Overlooked Operating System | Compiler: Stack/Unstuck
Linux, Shadowman, And Open Source Spirit | Compiler
Ricerca per canale
Automazione
Novità sull'automazione IT di tecnologie, team e ambienti
Intelligenza artificiale
Aggiornamenti sulle piattaforme che consentono alle aziende di eseguire carichi di lavoro IA ovunque
Hybrid cloud open source
Scopri come affrontare il futuro in modo più agile grazie al cloud ibrido
Sicurezza
Le ultime novità sulle nostre soluzioni per ridurre i rischi nelle tecnologie e negli ambienti
Edge computing
Aggiornamenti sulle piattaforme che semplificano l'operatività edge
Infrastruttura
Le ultime novità sulla piattaforma Linux aziendale leader a livello mondiale
Applicazioni
Approfondimenti sulle nostre soluzioni alle sfide applicative più difficili
Virtualizzazione
Il futuro della virtualizzazione negli ambienti aziendali per i carichi di lavoro on premise o nel cloud