cat

Official Description

Concatenates or displays files.

Syntax

cat [-benstvA] file... | -

Options

-A shows all.

-b numbers nonblank output lines.

-e shows $ at the end of lines.

-n numbers all output lines.

-s means squeeze-blank; never more than one single blank line.

-t shows tabs as ^I.

-v shows characters that typically do not print.

With no file, or when file is -, it reads standard input.

Oddities

Used to create small files (cat > xx).

Example

 $ cat -n buzz # Numbers the output lines 1 #! /bin/ksh 2 integer x=17 3 while : 4 do 5 x=17 6 done $ $ cat > small # Create small file junk more junk # Ctrl+D to end the input (at beginning of next line) $ $ cat small junk more junk $ $ cat -e small # Indicate line ends with $ junk$ more junk$ ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.