Linuxlab

Practice it end to end

Updated July 3, 2026

Put it all together on one task. A directory has many log files, and you need to clean it up and pull some statistics without opening a single file by hand.

  1. Create a working directory and generate the data:
$ mkdir ~/logs-lab && cd ~/logs-lab
$ for i in 1 2 3; do echo -e "INFO ok\nERROR fail\nINFO ok" > app$i.log; done

(We cover the for construct in detail in Part II; for now just run the line, it creates three files.)

  1. Look at the result: a detailed listing and the contents of one file through less.
  2. Collect every line containing ERROR from all the logs into a single file errors.txt with one command.
  3. Count how many ERROR lines you ended up w
Locked

The rest of this chapter is part of a paid course

You are reading the open part. Buy the course to read the whole chapter.

See the course