Start in the practice directory from chapter 1 and confirm it with pwd. The file field.txt contains four short lines. cat displays its contents:
cat field.txt
It prints Maple, River, maple leaf, and Stone, one per line. The name comes from concatenate: cat can print several files in order, without adding a separator between them. Avoid dumping an unknown binary file or a very large file into the terminal.
To inspect the ends instead, use:
head -n 2 field.txt
tail -n 2 field.txt
The first prints Maple and River; the second prints maple leaf and Stone. Here -n 2 asks for two lines. Without -n, these commands normally show up to ten lines. They read the file rather than changing it.
For a longer text file, less field.txt opens an interactive pager, if installed. Space moves forward, b moves backward, / starts a search (enter text and press Enter), and q exits. Its display and key behavior depend on the pager and terminal. more is another pager, but its features vary. If less is unavailable, use head and tail for this small example or consult your distribution’s installation instructions.