Signal9Signal9 — home
online
back to labs

Read the Ship's Log

EasyLinux Fundamentals10-15 min
The brief

A hundred-line voyage log sits at /root/voyage/log.txt — far too long to read by scrolling. This is what cat, less, head, and tail are for: cat pours the whole file onto the screen, less lets you page through it (q to quit), head shows the first lines, tail the last. The harbormaster wants two extracts filed in /root/answers/: the first 3 lines of the log saved as departure.txt, and the last 2 lines saved as arrival.txt. The > arrow sends a command's output into a file instead of the screen — head -n 3 /root/voyage/log.txt > /root/answers/departure.txt files the first extract; you take it from there.

What you'll do
  • Look at the log with cat, less, head, and tail — get a feel for each
  • Save the FIRST 3 lines to /root/answers/departure.txt
  • Save the LAST 2 lines to /root/answers/arrival.txt

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.