Lesson 2.4: Looking at text files: cat, less and more
Text files vs binary files; printing and joining files with cat (-n); reading long files page by page with the pagers less and more.
14 min
You will learn to
- Tell text files from binary files
- Print a file with cat and number its lines with -n
- Join several files with cat
- Read a long file with less and use its keys
Key terms
- Text file
- A file that contains only readable characters arranged in lines: configuration files, logs, scripts, notes.
- Binary file
- A file meant for programs, not people: compiled programs, images, archives. Printing one fills the screen with garbage.
- Log file
- A text file where programs record what happened and when, one event per line.
- Concatenate
- Join things end to end. cat takes its name from it: it joins its files and prints the result.
- Pager
- A program that shows long text one screen at a time and waits for your keys.
← Getting help on the command line · All lessons · The Linux filesystem hierarchy →