Four commands do most of the work when you need to look at a text file.
cat prints a file's contents to the terminal.
cat /etc/hostname
cat /etc/os-release
Great for short files. For anything long, use one of the tools below, otherwise the terminal fills up faster than you can scroll.
head prints the first 10 lines by default. tail prints the last 10.
Both take -n to change the count.
head /etc/os-release
head -n 3 /etc/os-release # first 3 lines only
tail -n 5 /etc/passwd # last 5 lines
These are perfect for log files where the interesting bit is usually near the top (startup) or bottom (most recent).
wc counts. Most of the time you'll use -l for line count.
wc -l /etc/passwd
Piped from another command, wc -l becomes "how many things did that
produce":
ls /etc | wc -l # how many entries live in /etc
You already used that trick in the previous topic.