Mission 5 of 30 · Milestone
Viewing Larger Files
Turn a deliberately messy folder into a structure another person can understand.
Use pagers and preview tools so big files do not overwhelm your screen.
Practice inside
~/linux-practice. Check your setup before you begin.
Prerequisite: Writing and Reading File Content
.
What you’ll practice
- Navigate less
- Use head and tail
- Count lines and words with wc
The mental model
- less opens a viewer; press q to quit.
- head shows the beginning; tail shows the end.
- Ctrl+C stops commands that keep running.
Try it in your terminal
Create a large file
Safe in practice folderGenerates a harmless file for viewing practice.
Run from ~/linux-practice
cd ~/linux-practice
for i in {1..100}; do echo "This is line number $i"; done > large.txt Preview file parts
Safe in practice folderShows first lines, last lines, and counts.
Run from ~/linux-practice
head -n 5 large.txt
tail -n 5 large.txt
wc large.txt
wc -l large.txt Open with less
Safe in practice folderPress Space for next page, /pattern to search, and q to quit.
Run from ~/linux-practice
less -N large.txt Put it into practice
- Open large.txt with less and search for line 50.
- Quit with q.
Check your result
The organized folder matches the milestone layout.
Milestone challenge
Starting only from your home directory, recreate a small workspace, add a 100-line file, inspect its beginning and end, and prove your final location and file count.
Common mistakes
- You open `less large.txt` and the terminal goes full-screen. You panic because nothing responds to typing. It's not frozen — it's waiting for viewer commands. Press `q` and you're back. Less is patient.
- A command keeps printing lines and you can't get back to your prompt. Ctrl+C is your escape key. It tells the running program to stop. Use it without guilt on your own practice files.
Check your understanding
Explain these in your own words. If you’re unsure, revisit the examples before moving on.
- How do you quit less?
- Which command shows the last 10 lines by default?
Your practice, your pace
Loading saved progress…