1.\" Copyright (c) 1989, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)cat.1 6.13 (Berkeley) 03/12/91 7.\" 8.Dd 9.Dt CAT 1 10.Os BSD 3 11.Sh NAME 12.Nm cat 13.Nd concatenate and print files 14.Sh SYNOPSIS 15.Nm cat 16.Op Fl benstuv 17.Op Fl 18.Ar 19.Sh DESCRIPTION 20The 21.Nm cat 22utility reads files sequentially, writing them to the standard output. 23The 24.Ar file 25operands are processed in command line order. 26A single dash represents standard input. 27.Pp 28The options are as follows: 29.Tw Ds 30.Tp Fl b 31Implies the 32.Fl n 33option but doesn't number blank lines. 34.Tp Fl e 35Implies the 36.Fl v 37option, and displays a dollar sign (``$'') at the end of each line 38as well. 39.Tp Fl n 40Number the 41.Ar output 42lines, starting at 1. 43.Tp Fl s 44Squeeze multiple adjacent empty lines, causing the output to be 45single spaced. 46.Tp Fl t 47Implies the 48.Fl v 49option, and displays tab characters as ``^I'' as well. 50.Tp Fl u 51The 52.Fl u 53option guarantees that the output is unbuffered. 54.Tp Fl v 55Displays non-printing characters so they are visible. 56Control characters print line ``^X'' for control-X; the delete 57character (octal 0177) prints as ``^?''. 58Non-ascii characters (with the high bit set) are printed as 59`.`M-'' (for meta) followed by the character for the low 7 bits. 60.Tp 61.Pp 62.Nm Cat 63is useful for getting files into a pipe, for instance, to sort 64two files together, 65the command 66.Pp 67.Dl cat file1 file2 | sort > sfile 68.Pp 69reads the contents of 70file1 and file2 sequentially, pipes it all to sort and places the 71newly sorted data in file3. 72.Pp 73Because of the shell language mechanism used to perform output 74redirection, the command ``cat file1 file 2 > file1'' will cause 75.P original data in file1 to be destroyed! 76.Pp 77The 78.Nm cat 79utility exits 0 on success, and >0 if an error 80occurs. 81.Sh SEE ALSO 82.Xr head 1 , 83.Xr more 1 , 84.Xr pr 1 , 85.Xr tail 1 86.Pp 87Rob Pike, 88.Em UNIX Style, or cat -v Considered Harmful 89USENIX Summer Conference Proceedings, 1983. 90.Sh HISTORY 91The 92.Nm 93command appeared in Version 7 AT&T UNIX. 94