Phase 2: Essential Tools
Chapter 2: Using Essential Tools
Mastering the fundamental tools every RHEL administrator needs: documentation, editing, and shell operations.
Key Concepts
Getting Help
| Tool | Purpose | Example |
|---|---|---|
|
Manual pages |
|
|
GNU documentation |
|
|
Quick reference |
|
|
Package documentation |
|
|
Better info reader |
|
Man Page Sections
| Section | Content | Example |
|---|---|---|
1 |
User commands |
|
5 |
File formats |
|
8 |
Admin commands |
|
Hands-On Exercises
Exercise 2.1: Man Page Navigation
# Open man page for passwd command
man passwd
# Navigation:
# /pattern - search forward
# ?pattern - search backward
# n - next match
# N - previous match
# g - go to beginning
# G - go to end
# q - quit
# Search for password-related pages
man -k password
apropos password
# Find the configuration file section
man 5 passwd
Exercise 2.2: Vim Essentials
# Create practice file
vim /tmp/practice.txt
Vim Modes:
| Mode | Enter | Purpose |
|---|---|---|
Normal |
|
Navigation, commands |
Insert |
|
Text entry |
Visual |
|
Selection |
Command |
|
File operations |
Exercise 2.3: I/O Redirection
# Redirect stdout to file
ls -la > files.txt
# Append stdout to file
echo "new line" >> files.txt
# Redirect stderr to file
find / -name "*.conf" 2> errors.txt
# Redirect both stdout and stderr
find / -name "*.conf" > results.txt 2>&1
# Modern syntax (bash 4+)
find / -name "*.conf" &> all.txt
# Discard output
command > /dev/null 2>&1
# Pipe and tee (split output)
ls -la | tee listing.txt | grep "^d"
Exercise 2.4: Shell Variables
# Set variable
MYVAR="hello world"
# Use variable
echo $MYVAR
echo ${MYVAR}
# Export for child processes
export MYVAR
# Important variables
echo $HOME $PATH $USER $SHELL $PS1
Exercise 2.5: History and Shortcuts
# History operations
history # show history
!n # execute command n
!! # execute last command
!string # execute last command starting with string
# Keyboard shortcuts
# Ctrl+a beginning of line Ctrl+e end of line
# Ctrl+u delete to beginning Ctrl+k delete to end
# Ctrl+w delete word backward Ctrl+r reverse search history
# Ctrl+l clear screen Ctrl+c cancel
Validation Checklist
-
Can you find a specific flag in a man page in under 30 seconds?
-
Do you know the difference between
man passwd(section 1) andman 5 passwd(section 5)? -
Can you search all man pages for a keyword:
man -k password | grep '(8)'? -
Can you create a file in vim, write 5 lines, save, and quit in under 60 seconds?
-
Can you redirect stderr only to a file while stdout goes to terminal?
-
Can you use
teeto split output to both a file and a pipe? -
Do you know
!!,!$, andCtrl+rfrom muscle memory?
|
Exam Reality: You have NO internet access. |
Common Mistakes
-
Using
infoinstead ofman— RHEL exam expectsmannavigation.infoworks differently and is slower if unfamiliar. -
Forgetting man sections —
man passwdgives you the command.man 5 passwdgives you the file format (/etc/passwdstructure). Section numbers are critical when names collide. -
Not knowing
apropos—aproposis identical toman -k. Both search man page descriptions. Use whichever sticks. -
Ignoring
$?— Every command returns an exit code.echo $?after a command tells you pass (0) or fail (non-zero). The exam tasks require verifying your work. -
Forgetting
2>&1order —command > file 2>&1redirects both.command 2>&1 > filedoes NOT (stderr goes to terminal). Order matters.
Exam Weight
| Weight | Topic |
|---|---|
Critical |
Man page navigation (your only reference on exam) |
Critical |
I/O redirection (used in every task) |
High |
Vim editing (must edit config files) |
Medium |
Shell variables and history (convenience, not tested directly) |
Diagram: I/O Streams
# I/O Streams in Linux
# Edit this D2 diagram as you learn
direction: right
title: Standard I/O Streams {
shape: text
style.font-size: 24
}
# Input/Output model
process: Process {
shape: rectangle
style.fill: "#e3f2fd"
style.stroke: "#1565c0"
style.stroke-width: 2
}
stdin: stdin (0) {
shape: parallelogram
style.fill: "#c8e6c9"
}
stdout: stdout (1) {
shape: parallelogram
style.fill: "#fff9c4"
}
stderr: stderr (2) {
shape: parallelogram
style.fill: "#ffcdd2"
}
keyboard: Keyboard {
shape: cylinder
style.fill: "#e0e0e0"
}
terminal: Terminal {
shape: cylinder
style.fill: "#e0e0e0"
}
file: File {
shape: document
style.fill: "#f3e5f5"
}
pipe: "| (pipe)" {
shape: hexagon
style.fill: "#b3e5fc"
}
# Connections
keyboard -> stdin: "default input"
stdin -> process
process -> stdout
process -> stderr
stdout -> terminal: "default output"
stderr -> terminal: "default errors"
# Redirection examples
stdout -> file: "> redirect"
stdin <- file: "< redirect"
stdout -> pipe: "to next command"
# Legend
legend: {
label: File Descriptors
style.fill: "#fafafa"
fd0: "0 = stdin (input)"
fd1: "1 = stdout (output)"
fd2: "2 = stderr (errors)"
}
Notes
Add personal notes as you work through this chapter.