Linux, terminal and Git

Stage 3 · Lesson 1 of 8

Viewing files: cat, less, head and tail

Text tools

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

Practise

  • Test regular expressions on sample text with a plain explanation of each part

  • Middle levels need grep, sort, uniq and find to locate the next password

Keep handy

  • The official jq manual with examples for every filter

  • Quick examples for find, sed, awk and friends when you forget the syntax

Mark this stage as not done?