cat Command
The cat command short for concatenate, It is a fast and versatile tool for viewing and merging file contents directly from the Linux terminal. Whether you’re inspecting logs or quickly joining multiple text files, cat delivers what you need with efficient simplicity.
You use cat to display the contents of files. Simply run:
cat filename.txtYou’ll instantly see everything written in the file printed to your screen. If you want to review the contents of several files at once, list them in sequence:
cat filename1.txt filename2.txt filename3.txtThe result is that cat outputs all three files’ data in order.
cat [OPTION] [FILE]Display file content directly:
cat report.txtShow the contents of files in succession:
cat intro.txt summary.txtMake each line identifiable for reviews or troubleshooting:
cat -n server.logQuickly create and populate a file by typing text followed by Ctrl+D to save:
cat > notes.txtMerge multiple files into a new one:
cat part1.txt part2.txt > merged.txtSuppress repeated empty lines in output:
cat -s messy.txtAdd content to the end of a file:
cat changelog.txt >> history.txtShow the $ at the end of every line for clarity:
cat -E notes.txtDisplay all text files in a folder:
cat *.txt| Option | Usage |
|---|---|
| -A | Show all characters, including non-printing |
| -b | Number only non-empty lines |
| -E | Display $ at end of every line |
| -n | Number all lines |
| -s | Squeeze multiple adjacent blank lines |
| -T | Show tabs as ^I |
| -v | Make non-printing characters visible |
| -u | Unbuffered output (rarely needed) |
From viewing a small config file to merging hundreds of logs for analysis, cat is a fundamental Linux skill that increases productivity at the terminal. Its versatility means every user, whether new or advanced benefits from mastering it.
Read More: History of Linux
The Windows Registry Editor lets you easily view and control critical Windows system and application…
In the rapidly expanding Internet of Things (IoT) ecosystem, billions of devices are constantly exchanging…
Have you ever come across a picture on the internet and wondered where it came…
Overview WhatsMyName is a free, community-driven OSINT tool designed to identify where a username exists…
Managing disk usage is a crucial task for Linux users and administrators alike. Understanding which…
Efficient disk space management is vital in Linux, especially for system administrators who manage servers…