This article brings you knowledge about the cat command in Linux. The cat command is used to connect files and print to the standard output device. I hope it will be helpful to everyone.
1. Operating environment
Win10 64-bit operating system CentOS7 MobaX
2. Definition of Linux cat command
The cat (full English spelling: concatenate) command is used to connect files and print to the standard output device.
3. Usage
cat [选项]... [文件]...
Output the [file] or standard input combination to the standard output.
4. Commonly used parameters
-n or --number: start from 1 for all outputs row number.
-b or --number-nonblank: Similar to -n, except that blank lines are not numbered.
-s or --squeeze-blank: When encountering two or more consecutive blank lines, replace them with one blank line.
-v or --show-nonprinting: Use ^ and M-symbols except LFD and TAB.
-E or --show-ends: Display $ at the end of each line.
-T or --show-tabs: Display TAB characters as ^|.
-A or --show-all: Equivalent to -vET.
-e: Equivalent to the "-vE" option.
-t: Equivalent to the "-vT" option.
5. Demonstration
5.1 Prerequisites
1. Start the virtual machine and connect Go to MobaX
2. Create two files with arbitrary content (the creation process is not the subject of this article and will not be described in detail. You can refer to Linux to create files in the directory) as shown in the figure below (in the following examples, we will follow the example Modify the two files test11 and test22 if necessary):
##5.2 Example
1. View the contents of the test11 file.cat test11
cat -n test11 或 cat --number
cat -b test22 或 cat --number-nonblank
cat -s test22 或 cat --squeeze-blank 或 nl test22
cat -E test22
cat test11 test22
cat test11 | more
cat test11 test22 > test33
cat test11 >>test33
Linux Video Tutorial"
The above is the detailed content of How to use the cat command in Linux in ten minutes. For more information, please follow other related articles on the PHP Chinese website!