Name
cat [options
] [files
] — coreutils
Synopsis
/bin
stdin stdout - file -- opt --help --version
The simplest viewer is cat
, which just copies its files to standard output, concatenating them (hence the name). Note that large files will likely scroll off screen, so consider using less
if you plan to view the output. That being said, cat
is particularly useful for sending a set of files into a shell pipeline.
cat
can also manipulate its output in small ways, optionally displaying nonprinting characters, prepending line numbers (though nl
is more powerful for this purpose), and eliminating whitespace.
Useful options | |
| Print tabs as ^I. |
| Print newlines as $. |
| Print other nonprinting characters in a human-readable format. |
| Prepend line numbers to every line. |
| Prepend line numbers to nonblank lines. |
| Squeeze each sequence of blank lines into a single blank line. |
Get Linux Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.