You do not need an editor simply to inspect text. cat, less, head, and tail all read files, but suit different lengths and positions.
cat: quickly print a short file
cat settings.conf prints everything at once, which is convenient for a short file. A long file scrolls past quickly and is better suited to less. cat part1.txt part2.txt prints both files in order, reflecting the original meaning of concatenate.
less: page and search
less system.log opens a scrollable pager. Arrow keys, Page Up, Page Down, or space commonly navigate; q exits, and /error searches for error. Exact shortcuts vary, but paging and search are the essentials.
cat short file, all content
less long file, page and search
head beginning only
tail end only
tail -f follow new lines
head and tail: choose one end
head access.log normally shows the first 10 lines, useful for a CSV header or configuration opening. head -n 20 access.log requests 20. tail normally shows the last 10 lines, where the newest log entries usually appear; tail -n 20 requests 20.
tail -f: continuously follow a log
tail -f app.log keeps running and shows lines as they are appended. It is common during server troubleshooting. The shell prompt does not return immediately; press Ctrl+C to stop it.
short → cat*·long → less·start → head·end → tail·*new → tail -f
Selection questions: How long is the file? Which part do you need? Is it still growing? Those answers usually identify the right command.
Switch Log Viewing Modes
Simulated terminal ready. Run commands and watch the filesystem on the right.
/homealicearchivebackupcachedataindex.bin
DocumentsDownloadsemptyPicturesprojectsrcREADME.md
.bashrc.profileaccess.logapp.logdraft.txterror.lognotes.txt
varlogsyslog
Quick buttons fill the prompt; run the command or press Enter to change terminal and filesystem state.KNOWLEDGE QUIZ
KNOWLEDGE QUIZ
Investigate a Deployment Failure
The server has an 8-line release.conf, a 5,000-line deploy.log, and a growing app.log. Write the best command for each task.
- Display the entire short configuration.
- Page through deploy.log and prepare to search for ERROR.
- Show the last 30 lines of deploy.log.
- Follow app.log continuously and state how to stop.