Linux Labs

First steps / Stage 9 of 15

Text and editors

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 8 · lab · 15 mineasy

View and search inside files

The end of a nightly log, its error lines and their count, each in its own file: tail and grep.

Situation

The backup ran overnight, and its log is ~/backup.log. In the morning a colleague asks how the backup ended and whether there were any errors. More than one program writes to this log, and each records errors in its own way.

Task

Make it so that:

  1. ~/last.txt holds the last 5 lines of ~/backup.log;
  2. ~/errors.txt holds every log line with the word error in any case, exactly as it is written in the log;
  3. ~/count.txt holds the number of those lines, a single number.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 3
  • ~/last.txt holds the last five log lines — not done yet
  • ~/errors.txt holds every line with the word error in any case — not done yet
  • ~/count.txt holds the number of those lines — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 3
  • ~/last.txt holds the last five log lines — not done yet
  • ~/errors.txt holds every line with the word error in any case — not done yet
  • ~/count.txt holds the number of those lines — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 3
  • ~/last.txt holds the last five log lines — not done yet
  • ~/errors.txt holds every line with the word error in any case — not done yet
  • ~/count.txt holds the number of those lines — not done yet
Loading…