Stage 3 · Lesson 1 of 8
Viewing files: cat, less, head and tail
There are a few ways to look at a file, and the right one depends on its size. cat prints the whole file, which is fine for short ones. less is a : it opens the file so you can scroll and search.
In less, /word searches, n jumps to the next match, G goes to the end and q quits. head -20 shows the first 20 lines and tail -20 the last 20. tail -f keeps following a file as new lines are added.
That is how you watch a log while an app runs. wc -l counts the lines.
Common trapcat on a huge , which floods your terminal and tells you nothing.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CourseFreeThe Missing Semester of Your CS Education
MIT · Beginner
The data wrangling lecture walks through grep, sed, awk and regular expressions on real logs
- BookFreeThe Linux Command Line
William Shotts · Beginner
Clear chapters on text processing, regular expressions and searching for files