Recap: Viewing Files
Chapter 3 gave you the file-inspection toolkit. Each command answers a different question:
| Command | Answers |
|---|---|
cat | "Show me the whole (short) file." |
head | "Show me the start." |
tail | "Show me the latest events." |
less | "Let me scroll through a long file." |
wc | "How big is it, how many lines/words?" |
A common workflow when inspecting logs: wc -l to size the file, head to see how it
begins, tail to see the newest entries.
Mission: Station Log Triage
The previous crew evacuated in a hurry and left three log files behind. Command needs a quick status report before we can re-occupy the station.
- Read
summary.login full. - View the first 3 lines of
events.log. - View the last 3 lines of
events.log. - Count the lines in
errors.log.
Expected result
You see the full summary, the first and last three events, and the error count (3 lines).