The cat command is used to print the connection file to the output device
Cat is the basic Text Output command for Linux and is typically used to view the contents of a file.
Grammar
Cat (Parameters) (option)
-N or--number: Numbers the number of rows for all outputs starting from 1.
-B or--number-nonblank: Similar to-n, except that blank lines are not numbered.
-S or--squeeze-blank: a blank line that is substituted for a row when it encounters a blank line that has more than two consecutive lines.
-V or--show-nonprinting: Use the ^ and m symbols, except for LFD and TAB.
-E or--show-ends: Displays $ at the end of each line.
-T or--show-tabs: Displays the TAB character as ^i.
-e: Equivalent to-ve.
-A,--show-all: equivalent to-vet.
-T: equivalent to the "-vt" option;
Cat Main Features
1. Display all contents of a file at once cat filename
2. Create a new file from disk Cat >filename (can only create new files cannot edit existing files)
3. Merge several files into one file cat?? File1?? File2? > File
Case
Cat-n file1 > File2 Add the file contents of the File1 and enter the File2 file.
Cat-b file1file2 >> file3 file1 and file2 document content with line numbers (blank lines not added) after attaching the contents to the File3 document:
If the original B.txt file is not. So:
Cat >b.txt <<eof
Eof
After entering the first line, input EOF, enter, you can generate a b.txt file. Where EOF is telling bash which symbol represents the end of the file. Of course you can also use your own custom symbols.
[email protected] tmp]$ cat >B.TXT<<ABC
1
2
3
Abc
[email protected] tmp]$ cat B.txt
1
2
3
Empty the contents of the/etc/test.txt document:
Cat/dev/null >/etc/test.txt
Cat commands-linux common commands cat usage