Learn › Linux Foundations › Text Processing
grep - a hands-on Linux lab on a real virtual machine.
The Text Processing module capstone mission. Drill grep, cut, sort, uniq, tr, sed, and awk in one hands-on operation over a real signal log on a real Linux VM. Mission mode: no commands shown, recall required.
You have finished the Text Processing module. Seven tools are yours now. grep keeps only the lines that match. cut slices one column out of every line. sort puts lines in order. uniq collapses repeats. tr swaps or strips characters. sed edits a stream in flight. awk sees a line as columns and prints the ones you name.
This is the final run. One real machine, one raw signal log, and seven objectives, each one a tool you already trained. Nothing new is introduced here.
This is mission mode. No commands are shown. You read the objective, recall the tool, and type it. That recall is the whole point: it is how these seven moves become instinct. Progress checks itself as you go, and a signal is one click away if you get stuck.
One quick rep in the practice terminal before the real machine boots. Same rules as the mission: the goal is stated, the command is not. If this comes back instantly, you are ready.
There is a log at the path below whose lines each start with a time, then a level, then a service, then a message, joined by colons. You want only the lines whose level is ERROR, and nothing else. Reach for the tool that keeps only the lines that match a word, and point it at the log.
prompt: student@linuxcamp:~$ answer: grep ERROR ~/ops/access.log ||| grep ERROR /home/student/ops/access.log ||| grep 'ERROR' ~/ops/access.log ||| grep "ERROR" ~/ops/access.log output: 09:ERROR:sshd:failed password for root 11:ERROR:sshd:failed password for root 13:ERROR:nginx:connection refused hint: The line-matching tool is grep. Give it the word to keep, then the file: grep ERROR ~/ops/access.log
Three lines came back, every one an ERROR, and the INFO and WARN lines dropped away. That move came from memory, not from a copy button. Good. The mission asks for that same recall six more times, with six more tools.
Boot the machine below and take the console. Seven objectives over one signal log: keep the lines that matter, slice out a column, put lines in order, squeeze out the repeats, rewrite characters, edit the stream, and address the log by columns. No commands shown, progress checks itself as you type.
Practice Signal Station: Operation Signal Extraction in a real Linux terminal at The Linux Camp. Progress is verified automatically as you type commands on the machine.