-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux cat Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to cat on Linux, covering Arch Linux, CachyOS, and other distributions including displaying files, concatenating files, and file operations.
cat (concatenate) displays and concatenates files.
Uses:
- Display files: Show file contents
- Concatenate: Combine files
- Create files: Create new files
- Append files: Add to files
Why it matters:
- File viewing: Quick file view
- File operations: Combine files
- Scripting: Useful in scripts
View file:
# Display file
cat file.txt
# Shows entire fileShow several:
# Display multiple files
cat file1.txt file2.txt
# Shows both filesNumber lines:
# Show with line numbers
cat -n file.txt
# Numbers all linesEnd markers:
# Show line endings
cat -E file.txt
# Shows $ at end of linesMerge files:
# Concatenate files
cat file1.txt file2.txt > combined.txt
# Combine into new fileAdd content:
# Append to file
cat file.txt >> existing.txt
# Or create new
cat > newfile.txt
# Type content
# Press Ctrl+D to saveCheck installation:
# Check cat
which cat
# Usually in coreutils
# Install if missing
sudo pacman -S coreutilsThis guide covered cat usage, file display, and concatenation for Arch Linux, CachyOS, and other distributions.
- head and tail Guide - File viewing
- less Guide - Pager
-
cat Documentation:
man cat
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.