LAB-FS-03 - Inside /var - The Living Data
FS File System Mastery
Inside /var - The Living Data
Inspect /var safely so you can find changing data such as logs and understand how to read it without making the situation worse.
45 min INTERMEDIATE LINUX Field-verified
Prerequisites
Success criteria
- Find likely log locations under /var.
- Use tail, less, or journalctl to inspect recent activity safely.
Safety notes
- Do not edit log files directly. Read them with tail, less, or journalctl.
Part A: The Field Guide
/var holds data that changes while the system runs. For most learners, the most important part is /var/log.
When a service fails, your job is usually not to guess. Your job is to inspect the latest evidence.
Safe Reading Rule
Use tail, less, or journalctl to inspect logs. Avoid opening active logs in an editor while you are still learning.
What to expect under /var
/var/logfor system and application logs/var/libfor persistent application data/var/spoolfor queued work waiting to be processed
Part B: The Drill Deck
Terminal required: you may need
sudofor some logs depending on your distribution.
G Guided Step by step - type exactly this and compare the result >
Exercise G1: Find the log area
- Run
cd /var/log - Run
ls | head - Notice the variety of logs and service-specific folders
Exercise G2: Read only the recent lines
- Run one of these, depending on your system:
sudo tail -n 20 /var/log/syslogsudo tail -n 20 /var/log/messages - Look at the latest timestamps
- Explain what
tailis helping you avoid
Exercise G3: Page through a larger log
- Run one of these:
sudo less /var/log/syslogsudo less /var/log/messages - Search inside the log with
/error - Press
nto move to the next match andqto quit
S Solo Task described, hints available - figure it out >
Exercise S1: Follow live updates
- Run one of these commands and leave it open:
sudo tail -f /var/log/syslogsudo tail -f /var/log/messages - In another terminal, run
logger "practice message" - Watch the new line appear
- Stop the follow session with
Ctrl+C
Exercise S2: Try journalctl
- Run
journalctl -n 20 - Then run
journalctl -f - Compare the experience with
tail -f
M Mission Real scenario - no hints, combine multiple skills >
Mission M1: Choose the right reading tool
For each situation below, name the tool you would use first and why:
- You want only the most recent lines.
- You want to search through a long log calmly.
- You are on a system where journalctl is the main source of service logs.
If you can choose the reader based on the task, you are learning the part that actually matters.