Encyclopedia > Cat (Unix)

  Article Content

Cat (Unix)

In Unix and Unix-like operating systems, the cat program concatenates the contents of files, reading from a list of files and/or standard input in sequence and writing their contents in order to standard output. cat takes the list of files as arguments but also interprets the argument '-' as standard input.

Jargon File definition

The Jargon File version 4.3.3 lists this as the definition of cat:

1. [techspeak] To spew an entire file to the screen or some other output sink without pause (syn. blast). 2. By extension, to dump large amounts of data at an unprepared target or with no intention of browsing it carefully. Usage: considered silly. Rare outside Unix sites. See also dd, BLT.

Among Unix fans, cat(1) is considered an excellent example of user-interface design, because it delivers the file contents without such verbosity as spacing or headers between the files, and because it does not require the files to consist of lines of text, but works with any sort of data.

Among Unix haters, cat(1) is considered the canonical example of bad user-interface design, because of its woefully unobvious name. It is far more often used to blast a file to standard output than to concatenate two files. The name cat for the former operation is just as unintuitive as, say, LISP's cdr.

Of such oppositions are holy wars made....

UUOC [from the comp.unix.shell group on Usenet] stands for `Useless Use of cat'; the reference is to the Unix command cat(1), not the feline animal. As received wisdom on comp.unix.shell observes, "The purpose of cat is to concatenate (or `catenate') files. If it's only one file, concatenating it with nothing at all is a waste of time, and costs you a process." Nevertheless one sees people doing

     cat file | some_command and its args ...

instead of the equivalent and cheaper

     <file some_command and its args ...

or (equivalently and more classically)

     some_command and its args ... <file

Since 1995, occasional awards for UUOC have been given out, usually by Perl luminary Randal L. Schwartz. There is a web page devoted to this and other similar awards. In British hackerdom the activity of fixing instances of UUOC is sometimes called demoggification.

External link



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
East Marion, New York

... and the median income for a family is $52,500. Males have a median income of $47,917 versus $31,250 for females. The per capita income for the town is $24,373. 5.8% of the ...

 
 
 
This page was created in 27.5 ms