Reading content: cat, less, head, tail -f
You reveal hidden characters with cat -A, read files backwards, from a given line and byte by byte, use less’s search and filter features, expose the real type of a "PDF" whose name lies by its magic bytes and with strings, follow a live-growing log with tail -f and stop the process writing it. The numbers and the hidden address differ in every lab.
Level 101 · 45 min
Odd things are happening on Northwind Logistics’ reporting server: a note file from Windows breaks scripts, an "invoice" PDF won’t open and a log file keeps growing. Team lead Daniel asks you to look at all of them.
In the quick start course you met cat, head, tail and less. In this lesson you learn the deeper features of the same tools: showing invisible characters, telling a file’s real type from its content and following a live file.
Analogy: a file’s name is the label on a parcel; its first bytes are the parcel itself. The label can lie, the content can’t.
What you will do in this lesson
- Invisible characters: cat -A
- From the start, the end, backwards: tail -n +2 and tac
- How many records? wc
- The power features of less
- Magic bytes: head -c and od
- Ask for the type: file
- Readable text in a binary: strings
- Follow live: tail -f
- Stop the writer
- Findings
- Short quiz
Skills you will earn
- Showing invisible characters (cat -A)
- Reading from a given line (tail -n +N)
- Reading a file backwards (tac)
- Counting lines (wc -l)
- Moving around and searching a long file (less)
- Reading magic bytes (head -c, od)
- Finding a file’s real type (file)
- Extracting text from binaries (strings)
- Following a log live (tail -f)
- Finding and stopping a process (pgrep, pkill)
- Writing a short, precise finding
← Links and finding files · Linux fundamentals · Short task: tidy a messy project folder and find the missing file →
Start for free