chat
No standard "chat" command exists in Linux
TLDR
Execute a chat script directly from the command line
Execute a chat script from a file
Set a custom timeout (in seconds) for expecting a response
Enable verbose output to log the conversation to syslog
Use a report file to log specific strings received during the conversation
Dial a phone number using a variable, substituting \T in the script
Include an abort condition if a specific string is received
SYNOPSIS
cat [OPTION]... [FILE]...
PARAMETERS
-A, --show-all
Equivalent to -vET, shows non-printing characters, tabs, and line endings.
-b, --number-nonblank
Number non-blank output lines, starting at 1. Overrides -n.
-E, --show-ends
Display $ at the end of each line to indicate line breaks.
-n, --number
Number all output lines, starting at 1.
-s, --squeeze-blank
Squeeze multiple adjacent blank lines into a single blank line.
-T, --show-tabs
Display TAB characters as ^I.
-u
(Ignored) This option is a POSIX standard for compatibility but has no effect on modern cat implementations as output is unbuffered by default.
-v, --show-nonprinting
Use ^ and M- notation, except for line feed (LF) and tab (TAB), to show non-printing characters.
--help
Display a help message and exit.
--version
Output version information and exit.
DESCRIPTION
The cat (short for "concatenate") command is a fundamental Unix and Linux utility. Its primary function is to read file content sequentially and write it to standard output. While its name implies concatenation, its most common modern usage is simply to display the content of one or more files directly to the terminal. Beyond mere viewing, cat is also widely used for combining multiple files into a single output stream or file, and for creating new files from standard input. It is an indispensable tool often employed in shell scripts and command pipelines, typically in conjunction with input/output redirection operators (like > for overwriting, >> for appending) or pipes (|) to feed file content to other commands for further processing.
CAVEATS
When dealing with very large files, cat loads the entire content into memory (or buffers it to standard output), which can be inefficient and consume significant resources. For interactive viewing of large files, commands like less or more are generally preferred as they allow scrolling and do not load the entire file at once.
Be cautious when redirecting output using the > operator (e.g., cat file1 > file2), as it will overwrite the destination file (file2 in this example) without warning if it already exists. Use >> to append instead (e.g., cat file1 >> file2).
STANDARD INPUT/OUTPUT
When no FILE is specified, or when FILE is given as a single hyphen (-), cat reads from its standard input until an end-of-file (EOF) signal is received (typically by pressing Ctrl+D). This makes it incredibly versatile for use in pipelines, where it can process output from other commands. For example, command | cat - file2 > combined_file
allows you to concatenate the output of 'command' with 'file2' into 'combined_file'.
HISTORY
The cat command is one of the earliest Unix commands, predating the C programming language itself. It was originally implemented in assembly language for the PDP-7. Its name is derived from "concatenate," reflecting its initial primary purpose of joining files. While still capable of concatenation, its most prevalent modern use, displaying file contents on the standard output, was somewhat an unintended consequence of its design, often humorously referred to as an "abuse" by its original developers.