Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (7229 KB)
cat(1)Name | Synopsis | Description | Options | Operands | Usage | Examples | Environment Variables | Exit Status | Attributes | See Also | Notes Name
Synopsis/usr/bin/cat [-nbsuvet] [file...] ksh93cat [-bdenstuvABDEST] [file...] Description/usr/bin/catThe cat utility reads each file in sequence and writes it on the standard output. Thus:
prints file on your terminal, and:
concatenates file1 and file2, and writes the results in file3. If no input file is given, cat reads from the standard input file. ksh93The cat built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when cat is executed without a pathname prefix and the pathname search finds a /bin/cat or /usr/bin/cat executable. cat copies each file in sequence to the standard output. If no file is specified, or if the file is -, cat copies from standard input starting at the current location. Options
/usr/bin/catThe following options are supported by /usr/bin/cat: When used with the -v option, the following options can be used: The -e and -t options are ignored if the -v option is not specified. ksh93ksh93 cat supports the following options: Operands
The following operand is supported: UsageSee largefile(5) for the description of the behavior of cat when encountering files greater than or equal to 2 Gbyte ( 231 bytes). ExamplesExample 1 Concatenating a FileThe following command writes the contents of the file myfile to standard output:
Example 2 Concatenating Two files into OneThe following command concatenates the files doc1 and doc2 and writes the result to doc.all.
Example 3 Concatenating Two Arbitrary Pieces of Input with a Single InvocationWhen standard input is a terminal, the following command gets two arbitrary pieces of input from the terminal with a single invocation of cat:
when standard input is a terminal, gets two arbitrary pieces of input from the terminal with a single invocation of cat. If standard input is a regular file,
would be equivalent to the following command:
because the entire contents of the file would be consumed by cat the first time - was used as a file operand and an end-of-file condition would be detected immediately when - was referenced the second time. Environment VariablesSee environ(5) for descriptions of the following environment variables that affect the execution of cat: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. Exit Status
The following exit values are returned: AttributesSee attributes(5) for descriptions of the following attributes: /usr/bin/cat
ksh93See AlsoNotesRedirecting the output of cat onto one of the files being read causes the loss of the data originally in the file being read. For example,
causes the original data in filename1 to be lost. Name | Synopsis | Description | Options | Operands | Usage | Examples | Environment Variables | Exit Status | Attributes | See Also | Notes |
||||||||||||||||||