$cat
Concatenate and print file contents directly to the terminal standard output.
cat [OPTIONS] [FILE...]Try `cat` Live in Interactive Sandbox
Zero-install client simulation with real-time feedback.
Overview & How cat Works
The `cat` utility (short for "concatenate") reads files sequentially and prints their contents to stdout. Beyond displaying file contents, `cat` is widely used with redirection operators (`>` and `>>`) to merge multiple files into one, create new text files, or append text logs.
Common Flags & Command Options
| Flag / Option | Description |
|---|---|
| -n | Number all output lines starting from 1. |
| -b | Number only non-blank output lines. |
| -s | Squeeze multiple consecutive blank lines into a single blank line. |
| -E | Display a dollar sign ($) at the end of each line. |
Practical Real-World Examples
cat -n welcome.txtReads welcome.txt and prints each line prefixed with its line index.
cat /etc/os-releaseDisplays Linux distribution and kernel release information.
Frequently Asked Questions
How do you view large files without filling the terminal?
For large files, use `head` or `tail` instead of `cat` so you can inspect specific portions of output.
Related Linux Commands
Search for files and directories in a directory hierarchy based on name, type, size, or modification date.
Create new directories and folder hierarchies.
Remove files or directories from the filesystem.
Copy files and directories to a destination path.
Move or rename files and directories.
Create empty files or update file access and modification timestamps.