cat flags & options

-n, --number

Number all output lines.

cat -n file.txt

-b, --number-nonblank

Number only non-blank lines.

cat -b file.txt

-s, --squeeze-blank

Squeeze multiple consecutive blank lines into one.

cat -s file.txt

-A, --show-all

Show all non-printing characters, tabs as ^I, and line endings as $.

cat -A file.txt

-E, --show-ends

Show $ at the end of each line. Useful for spotting trailing whitespace.

cat -E file.txt

-T, --show-tabs

Display tab characters as ^I.

cat -T Makefile

Concatenate files

Pass multiple files to combine them.

cat header.txt body.txt footer.txt > page.html
cat part1.csv part2.csv > combined.csv