cat

concatenate inputs and output them to standard output

cat [option …] [ input ]

With no input specified, or when input - reads standard input.

Does not support --.
-e end-of-line $ AND show unprintables, -t shows [TABS] and nonprintables, -v shows unprintables and control chars with ^
-l lock output, -u output not buffered.

-v
--show-nonprinting
use ^ and M- notation, except for [newline] and [TAB]
-E
--show-ends
display $ at end of each line
-b
--number-nonblank
number nonempty output lines, overrides -n i.e.line numbers
-n
--number
number all output lines (i.e. does not count blank lines skipped with -s
-s
--squeeze-blank
suppress repeated empty output lines
-T
--show-tabs
display TAB characters as ^I

-A
--show-all
equivalent to -vET i.e. show-nonprinting, $ at end of lines, show-tabs
-e equivalent to -vE i.e. show-nonprinting, show-ends
-t equivalent to -vT i.e. show-nonprinting , show-tabs
--help
--version

EXAMPLES

Output the contents of the file part1, then standard input, then the contents of file part2
cat part1 - part2
cat -An sampleFile
     1  11111111$
     2  $
     3  33333333$
     4  444444    $
     5  tab^Ix$

Warning

  • Because of the shell mechanism used to perform output redirection
    cat file1 file2 >file1
    overwrites file1 with the contents of file2.

  • attempting to concatenate file1 and file2 into file1
    cat file1 file2 >>file1
    continues appending file1 to file1 until the file system is full ! or interrupted.