concatenate inputs and output them to standard output

cat [option …] [ input ]

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

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

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


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$


  • 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.