Clean Up the Ship's Logs

Linux lab Intermediate 5 tasks 20 points

The ship's computer in ~/ship/logs is full of log files and leftover temporary files. Find the errors, save them for the engineer, and tidy up.

How it works: the terminal below is a real Linux machine running in your browser. Click it and type. Tasks tick themselves off as you complete them; questions are answered in the box under each task. Press Reset any time for a fresh machine. Your password on this machine (for sudo) is student.

student@vulntech:~ Starting…
Getting your Linux machine ready…
The first start downloads about 20 MB. After that your browser keeps it, and labs start in a moment.

Hints

Work inside ~/ship/logs so the *.log and *.tmp patterns are short.

Solution explanation

grep -c counts matches per file (engine 3, radar 2, crew 0: 5 in all). grep -h prints the matching lines without file names, and > saves them. The *.tmp pattern removes only the temporary files.

Show solution
cd ~/ship/logs
grep -c ERROR *.log
grep -h ERROR *.log > ~/ship/errors.txt
rm *.tmp
mkdir ~/ship/archive
mv crew.log ~/ship/archive/
HOME LABS COMMUNITY DASHBOARD