


However, for some multimedia digital container formats, the resulting file is valid, and so cat provides an effective means of appending files. cat does not provide a way to concatenate Unicode text files that have a Byte Order Mark or files using different text encodings from each other.įor many structured binary data sets, the resulting combined file may not be valid for example, if a file has a unique header or footer, the result will spuriously duplicate these. As such, its two main use cases are text files and certain format-compatible types of binary files.Ĭoncatenation of text is limited to text files using the same legacy encoding, such as ASCII. cat does not destroy non-text bytes when concatenating and outputting. -v (GNU: -show-nonprinting), displays nonprinting characters, except for tabs and the end of line characterĬat can be used to pipe a file to a program that expects plain text or binary data on its input stream.POSIX does not specify the behavior without this option. -t implies -v, but also display tabs as ^I (GNU: -T the same, but without implying -v).-s (GNU: -squeeze-blank), squeeze multiple adjacent blank lines.-n (GNU: -number), number all output lines.

-e implies -v but also display end-of-line characters as $ (GNU only: -E the same, but without implying -v).-b (GNU: -number-nonblank), number non-blank output lines.If no files are specified, cat reads from standard input only. If one of the input filenames is specified as a single hyphen ( -), then cat reads from standard input at that point in the sequence. Some operating systems, like the ones using GNU Core Utilities, do this by default and ignore the flag. The specification mandates the support of one option flag, u for unbuffered output, meaning that each byte is written after it has been read.

The Single Unix Specification defines the operation of cat to read files in the sequence given in its arguments, writing their contents to the standard output in the same sequence. The ReactOS version was written by David Welch, Semyon Novikov, and Hermès Bélusca. The version of cat bundled in GNU coreutils was written by Torbjorn Granlund and Richard Stallman. It was written by Ken Thompson and Dennis Ritchie. Cat was part of the early versions of Unix, e.g., Version 1, and replaced pr, a PDP-7 and Multics utility for copying a single file to the screen.
