cat
Concatenate multiple files and print to standard output.
Summary
cat [OPTION]... [FILE]...
The main purpose
Parameters
FILE (optional): The file to be processed, which can be one or more.
Options
Long options are equivalent to short options
-A, --show-all Equivalent to the "-vET" combination option.
-b, --number-nonblank Only number non-blank lines, starting from 1, overriding the "-n" option.
-e is equivalent to the "-vE" combination option.
-E, --show-ends Display '$' characters at the end of each line.
-n, --number Number all lines, starting from 1.
-s, --squeeze-blank Squeeze consecutive blank lines into one line.
-t is equivalent to the "-vT" combination option.
-T, --show-tabs Use "^I" for TAB (tab character).
-u POSIX compatibility option, meaningless.
-v, --show-nonprinting Use "^" and "M-" symbols to display control characters, except LFD (line feed, that is, newline character '\n') and TAB (tab character).
--help Display help information and exit.
--version Display version information and exit.
return value
The return status is success unless illegal options or illegal parameters are given.
example
# Combine and display multiple files
cat ./1.log ./2.log ./3.log
# Display non-printing characters, tabs, and newlines in the file
cat -A test.log
# Blank lines in compressed files
cat -s test.log
# Display the file and append line numbers to the beginning of all lines
cat -n test.log
# Display the file and append line numbers to the beginning of all non-blank lines
cat -b test.log
# Display the contents of standard input and the contents of the file together
echo '######' |cat - test.log
Notice
-
This command is a command in the
GNU coreutilspackage. For related help information, please viewman -s 1 catorinfo coreutils 'cat invocation'. -
When using the
catcommand to view larger files, the text flashes across the screen quickly (scrolls), and the user often cannot see the displayed content clearly. To control the scrolling, pressCtrl+ Press the skey to stop scrolling; press theCtrl+qkey to resume scrolling; press theCtrl+c(interrupt) key to terminate the execution of the command and return to the Shell prompt state. -
It is recommended that you use
less,morecommands or text editors such asemacsandviwhen viewing larger files.


