Skip to content

Linux cat Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux cat Guide

Complete beginner-friendly guide to cat on Linux, covering Arch Linux, CachyOS, and other distributions including displaying files, concatenating files, and file operations.


Table of Contents

  1. Understanding cat
  2. cat Basics
  3. Displaying Files
  4. Concatenating Files
  5. Troubleshooting

Understanding cat

What is cat?

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

cat Basics

Display File

View file:

# Display file
cat file.txt

# Shows entire file

Multiple Files

Show several:

# Display multiple files
cat file1.txt file2.txt

# Shows both files

Displaying Files

With Line Numbers

Number lines:

# Show with line numbers
cat -n file.txt

# Numbers all lines

Show Endings

End markers:

# Show line endings
cat -E file.txt

# Shows $ at end of lines

Concatenating Files

Combine Files

Merge files:

# Concatenate files
cat file1.txt file2.txt > combined.txt

# Combine into new file

Append to File

Add content:

# Append to file
cat file.txt >> existing.txt

# Or create new
cat > newfile.txt
# Type content
# Press Ctrl+D to save

Troubleshooting

cat Not Found

Check installation:

# Check cat
which cat

# Usually in coreutils
# Install if missing
sudo pacman -S coreutils

Summary

This guide covered cat usage, file display, and concatenation for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally