See what's inside a file
Read file contents with cat
⏱ Est. ~4 min
01 · Read
A file isn't just a name on your screen — it has content inside. The cat command lets you read file contents directly in the terminal.
💡 Picture thisIf a file is a sealed envelope, cat is tearing it open and reading the letter inside.
Key points
- cat is short for concatenate (though mostly it's used for reading files)
- It prints the entire file contents to your screen
- Best for short files — long files scroll past too fast to see
02 · Terminal exercise
ls shows you which files exist, but how do you see what's inside? That's cat's job — it dumps the file contents straight to your screen.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Let's read another file. Config files often store settings in a key=value format.
(This section is interactive — please enable JavaScript.)
04 · Terminal exercise
One more. Let's peek at the HTML file that makes up this website.
(This section is interactive — please enable JavaScript.)
05 · Fill in the blank
To display the full contents of a file called readme.txt, you would type: ___ readme.txt
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.