PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated 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 matchiTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Use cat to display a whole file, head to show its beginning, and tail to inspect its ending or watch new log entries appear. These commands display or stream file contents; they do not edit, move, or delete files.
Choose the right command
| Command | What it displays | GNU default | Example |
|---|---|---|---|
cat |
All supplied input, including multiple files in sequence | Entire input | cat notes.txt |
head |
The beginning of a file | First 10 lines | head -n 5 notes.txt |
tail |
The ending of a file; can also follow appended output | Last 10 lines | tail -n 20 notes.txt |
The defaults and options described here are documented for GNU Coreutils 9.11. Other implementations may differ, so check the manual installed on your system if an option behaves differently.
Display a complete file with cat
Run cat followed by a filename to send the file’s contents to standard output, which normally appears in your terminal:
Recommended Free Tools
cat notes.txt
To display several files one after another, list them in order:
#1 Best Overall
cat part1.txt part2.txt
cat can also read standard input when no filename is supplied, or when you use - as an input name. For example, cat - reads from standard input and writes what it receives to standard output. Because it prints the whole input, cat is convenient for short files; for a large file, showing a selected section with head or tail is generally easier to inspect.
Show line numbers or make characters visible
GNU cat offers a few useful display options:
cat -n notes.txtnumbers every output line.cat -b notes.txtnumbers nonempty lines.cat -E notes.txtmarks line endings.cat -T notes.txtshows tab characters.cat -v notes.txtreveals nonprinting characters.cat -s notes.txtsqueezes repeated adjacent blank lines.
Preview a file’s beginning with head
GNU head prints the first 10 lines by default:
head notes.txt
Use -n with a number to choose a different line count. This example shows the first five lines:
head -n 5 notes.txt
When you supply multiple filenames, GNU head identifies each input with a header in its output.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesInspect a file’s ending with tail
GNU tail prints the last 10 lines by default. To see a longer ending, specify the number of lines with -n:
tail -n 20 notes.txt
For multiple input files, GNU tail prints a header identifying each file.
Follow a log as it grows
Use -f to keep displaying new content appended to a file. For example:
Rank #4
tail -f /var/log/example.log
This is useful when monitoring a log while another process is writing to it. The command continues running as new output arrives; stop it with Ctrl+C. Follow behavior and additional options can vary by implementation, so consult your system’s tail manual for specifics.
Know what these commands do—and do not do
cat, head, and tail output file contents; they are not file editors or general file-management commands. The GNU Coreutils manual treats displaying whole files and parts of files separately from operations such as copying, moving, and deleting. To check available options on your system, use man cat, man head, or man tail.
Quick Recap
Best Value
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.

