cat (Unix)

The version of cat bundled in GNU coreutils was written by Torbjorn Granlund and Richard Stallman.

The specification mandates the support of one option flag, u for unbuffered output, meaning that each byte is written after it has been read.

Among Unix critics, cat(1) is considered the canonical example of bad user-interface design, because of its woefully unobvious name.

[citation needed] Useless use of cat (UUOC) is common Unix jargon for command line constructs that only provide a function of convenience to the user.

Example of a common cat abuse is given in the award: This can be rewritten using redirection of stdin instead, in either of the following forms (the first is more traditional): Beyond other benefits, the input redirection forms allow command to perform random access on the file, whereas the cat examples do not.

Another common case where cat is unnecessary is where a command defaults to operating on stdin, but will read from a file, if the filename is given as an argument.

A cat written with UUOC might still be preferred for readability reasons, as reading a piped stream left-to-right might be easier to conceptualize.

[14] Also, one wrong use of the redirection symbol > instead of < (often adjacent on keyboards) may permanently delete the content of a file, in other words clobbering, and one way to avoid this is to use cat with pipes.