cat command
Print files, join them together, or create small files.
- Text processing
- Package coreutils
- 5 options · 6 examples
Syntax
cat [options] [file…]Provided by the coreutils package. Run man cat for the full manual.
Common options
| Option | What it does |
|---|---|
-n | Number all lines |
-b | Number non-empty lines |
-s | Squeeze repeated blank lines |
-A | Show tabs, line ends and other invisible characters |
-E | Show $ at the end of each line |
Examples
Print a file
cat /etc/os-releasePrint with line numbers
cat -n script.shJoin files into one
cat part1.txt part2.txt > full.txtAppend a file to another
cat extra.txt >> main.txtCreate a file from the keyboard (Ctrl+D to finish)
cat > notes.txtShow hidden characters
cat -A file.txt
No example matches. Check the options table or search the guides.
Tips
- For long files use
less; for the start or end useheadortail.
cat guides
- 11 Practical Example of cat Command in Linux Linux Commands · Updated Apr 2025
