Read both ends of a file
Quest: read-file-ends
Mission
Use head -n 5 and tail -n 5 on /etc/services.
Why This Matters
Large files are not read top to bottom every time. Unix gives you tools for inspecting the beginning or end quickly.
Commands You Will Use
headtail
Steps
- Run
head -n 5 /etc/services. - Read the five lines shown.
- Run
tail -n 5 /etc/services. - Read the five lines shown.
- Ask the guide to check your work.
Hints
headshows the start of a file.tailshows the end of a file.-n 5means show five lines.
If Check Fails
The guide needs to see both commands exactly: head -n 5 /etc/services and tail -n 5 /etc/services.

Linux Foundations