Use cat to print a short file or send its contents into another command, head to preview the beginning, and less to scroll through or search a longer file. The examples below assume each named file exists and is readable.
Choose the command for the job
| What you need | Command | What it does |
|---|---|---|
| Print a short file or pass its contents to another command | cat file.txt |
Writes the file’s contents to standard output. |
| Check the beginning of a file | head file.txt |
Shows the first 10 lines by default. |
| Scroll through or search a longer file | less file.txt |
Opens an interactive pager for browsing. |
| Read several files in sequence | cat one.txt two.txt or less one.txt two.txt |
cat streams their contents together; less lets you browse them interactively. |
Print or combine content with cat
Run cat followed by a filename to write the file’s contents to the terminal:
As an Amazon Associate I earn from qualifying purchases.
cat README.txt
GNU Coreutils describes cat as copying each file—or standard input when no files are given—to standard output. That makes it useful for short files and pipelines, but it does not provide scrolling or search. A long file can fill the terminal’s scrollback; use less when you want to browse instead. See the GNU Coreutils cat documentation.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallTo stream two files one after another, list both names:
#1 Best Overall
cat first.txt second.txt
With no filename, cat waits for standard input. In an interactive terminal, type the text and press Ctrl-D to signal the end of input. You can also pass file contents to another command with a pipe:
cat notes.txt | less
GNU Coreutils also documents options such as -n to number every output line, -b to number nonempty lines, and -A to make line endings, tabs, and nonprinting characters more visible. These are GNU-specific options, not a guarantee for every Unix-like system.
Preview the beginning with head
By default, head prints the first 10 lines of a file:
Free tools Windows power users keep installed
One-click scans. No signup required.
head report.txt
Use -n to choose a line count, or GNU head -c to choose a byte count:
head -n 25 report.txt
head -c 300 report.txt
For example, to take just the first two lines from text produced by another command:
printf 'alphanbetangamman' | head -n 2
GNU head reads standard input if you give it no filenames, or if you use - as a filename. When given multiple files, it prints a header naming each file by default; -q suppresses those headers and -v requests them. Prefer explicit -n or -c forms in scripts; the GNU manual marks an older compact option syntax obsolete. See the GNU Coreutils head documentation.
Rank #4
head is a bounded preview, not a navigation tool: it shows the start rather than letting you move around the file.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Browse and search with less
Open a file in the pager by running:
less /var/log/example.log
Use these basic keys to navigate:
- Press Space or
fto move forward. - Press
bto move backward. - Type
/patternand press Enter to search forward for a pattern; pressnto go to the next match. - Press
qto quit.
You can also pipe command output into the pager when it is too long to inspect in the terminal window:
Best Value
journalctl | less
The Linux less(1) manual page says that less can start before it has read the entire input file. For a file that is changing, less +F filename enters forward-follow behavior at the end of the file; press Ctrl-C to return to ordinary navigation.
Version and portability notes
The GNU-specific cat and head behavior described here follows the GNU Coreutils 9.11 manual. The cited Linux less(1) page identifies less 704 and is dated 30 May 2026. Other Unix-like systems may have different implementations or options, so check the local manual page if a GNU-specific flag is unavailable. The general task choice—stream a short file with cat, preview its beginning with head, or browse with less—is based on the documented behavior of these commands.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools




