The Linux manual, referred to as man pages, is a digital document contained in almost all Linux distributions. The man pages cover all the foundational topics of Linux, including basic commands, programming, command-line tools, and even abstract concepts. Learning to effectively use man pages will provide Linux users a competitive edge when working in the Linux environment. Information about any Linux command can be found within the man pages, if you know how to find it.
To effectively use man pages, you need to know how to open the man page from the terminal and how you search on man pages. Specifically, you need to learn which command allows you to search the man pages by keywords. This virtual lab will give you hands-on experience using the man pages and searching them by keyword. This lab will also teach you how to search within the results for specific text using the grep command. These skills are important to many career fields, such as Cyber Operator and Exploitation Analyst work roles, among many others.
Understand the scenario: You are a UNIX/Linux system administrator for a company that is migrating to a Linux environment. You need to increase your knowledge of the Linux command-line environment. First, you will review navigation commands by using the command-line interface (CLI). Next, you will perform a keyword search of a Linux man page. Finally, you will filter the output of a search.
Understand the environment: You are using a Linux Ubuntu distribution. You have been automatically logged in to the console.
Install the man pages:
The first step of this hands-on lab is to install the man pages for Linux. To do this, you will first update your repositories using the apt-get command and install and uncompress the man pages.
Navigate a man page by using the keyboard:
For the next step, you will learn how to open and navigate the man pages using the command line. You will:
- Display a man page by using the man command.
- Display the help page and review the the navigation commands.
- Quit the man page.
Filter the output of a search by using grep:
Last, you will learn how to filter search search results using the grep command. You will:
- Create a file.
- Use the man page for grep to understand its usage.
- Use grep to search the created file for specific lines of text.
Filter the output of the man command by using grep:
The man pages are comprised of eight sections, and commands can be found in multiple sections. The first section contains information about the basic Linux commands and their uses, so you will often only need results from Section 1. To conclude this lab, you will learn how to combine the grep command with the man command to optimize your man pages searches. You will learn how to narrow you man pages search by:
- Searching the man pages for a keyword.
- Piping the output to the grep command to find results within only Section 1.
After completing the “CLI Search of ManPages” challenge, you will have performed the following:
- Displayed Linux man pages.
- Searched individual man pages for specific words.
- Performed a keyword search of the man pages.
- Filtered search results by using the grep command.
- Filtered search results based on a specified section.
Other Challenges in this series
- GUIDED CHALLENGE: Use the Appropriate Section of a Manpage
- ADVANCED CHALLENGE: Can You Use Several Man Pages at Once?