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.
저자 소개
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!
유사한 검색 결과
More than meets the eye: Behind the scenes of Red Hat Enterprise Linux 10 (Part 4)
Beyond modularity and other upgrades: The game-changer for your IT planning
The Overlooked Operating System | Compiler: Stack/Unstuck
Linux, Shadowman, And Open Source Spirit | Compiler
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래