cat displays and concatenates text files. It copies each file argument to the standard output. If you specify no files or give - as a file name, cat reads the standard input.
Besides normal ASCII text files, cat also works on
UTF-8 files and 16-bit wide Unicode files. Such files normally begin with
a multiple-byte marker indicating whether the file's contents are Unicode
big-endian, Unicode little-endian, or UTF-8. Such files are detected
automatically by cat; however, when the multiple-byte
marker is missing you can use the
With the cat utility, the TK_STDIO_DEFAULT_INPUT_FORMAT and TK_STDIO_DEFAULT_OUTPUT_FORMAT environment variables are ignored if the
-Uoption is used to explicitly set the input or output format. The formats specified with the -Uoverride the formats indicated by the environment variables.
Normally, cat's output format defaults to the format
of the first file it displays unless the
When using the cat utility with shell redirection to copy binary files, cat normally performs a raw copy, preserving the 8-bit integrity of the file. The multiple-byte marker that begins some 16-bit wide character and UTF-8 Unicode files is also preserved. Because of this, concatenating multiple binary files (including Unicode files) is likely to produce results that few utilities can interpret. This behavior, however, is overridden by the
-Uoption if its specifiers apply to the output produced.
displays a $ character at the end of each line. This option only works if you also specify
does not produce an error message if cat cannot find or read a specified file.
displays tabs as ^I. This option only works if you also specify
-v. -U[[[ c][ lb8oa]][ p[ lb8oa]]]
specifies the input format of any file missing the initial multiple-byte marker, the output format produced, or both.
cis specified, the specifiers that follow it apply to the input consumed.
pis specified, the specifiers that follow it apply to the output produced.
cnor pare specified, the remaining -Uspecifiers apply to the input consumed.
cand pare specified, the remaining -Uarguments apply to both input and output.
The remaining specifiers indicate the format of the characters read from input or written to output (as determined by
cand p): llittle-endian 16-bit wide characters bbig-endian 16-bit wide characters 8UTF-8 characters aASCII characters from the ANSI code page oASCII characters from the OEM code page
When multiple format specifiers can be associated with either c or p, the last appropriate one given on the command for each of c and p is used. For example:
is the same as:
When a p specifier is given without a c specifier and format specifiers are given before the p specifier, those format specifiers apply to the input. For example:
is the same as:
When c or p is specified with no format specifies, little endian 16-bit wide characters are used by default for either input or output, as appropriate.
As an alternative to specifying formats for both input and output with the same
-Uoption, you can specify the -Uoption multiple times. For example, the following are identical: -Uca -Upb -Ucapb
-Uspecifiers are actually case-insensitive. For example, the following are all identical in their behavior: -Ucl -UcL -UCl -UCL -u
does not buffer output.
displays all characters including those that are unprintable. If the character is unprintable, then one of three representations is used. M-X is used for character X if the significant bit is set; ^X is used for the control character X (for example, ^A for CTRL-A), and \xxx represents a character with the octal value xxx. The last form is used if neither of the other representations can be used.
Sets the default output format. Normally the format of the first file read is used as the default output format. The value must be one of those listed in the File Character Formats section of the unicode reference page.
Possible exit status values are:
Failure due to any of the following:
Unknown option specified on the command line.
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.1 Documentation Build 15.