Using Input/Output Redirection and Analyzing Text on RHEL 8

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

A Linux system administrator’s life is filled with text files and data. It’s easier to make sense of this mountain of data using the `grep` utility combined with the power of regular expressions. Input/output redirection is also an important skill for Linux system administrators, who can use it to create log files, quiet error messages, manipulate and sort data, and more. In this hands-on lab, we will explore input/output redirection as well as using `grep` and regular expressions to analyze and manipulate text.

*This course is not approved or sponsored by Red Hat.*

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Use Input/Output Redirection
  1. Generate a server information custom log file and append to it.
  2. Generate a log file of a user’s owned file in a directory structure, excluding errors.
  3. Number the log file for reference and sort it with various options.
  4. Generate a listing of the top level directories under /etc with space usage and then sort the listing from smaller to larger space usage.
Use Grep and Regular Expressions to Analyze Text
  1. Use the find command and options to search file contents with grep.
  2. Produce a listing of files that contain a particular string.
  3. Decide if the style of output does not suit your purposes and use grep to find the the information, including adding options or commands to get the right result.

Additional Resources

In this lab, you're a mid-level systems administrator who is tasked with generating text log files from queries and manipulating that text to produce usable reports. You'll use features such as command substitution, redirection, file creation, appending to existing files, and directing standard output and standard error in order to remove bad data and produce your reports with usable data.

You'll then use find and grep to search not only for existing files but also for strings that are contained in files. You'll also be counting the output, discarding unusable output, and verifying that your searches yield proper results. Finally, you'll use grep in an alternative fashion to first find search strings using various display options and then apply additional useful output options to create usable reports with all needed information.


Red Hat Exam Requirements Covered:

  • Use input-output redirection (>, >>, |, 2>, etc.)
  • Use grep and regular expressions to analyze text

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?