cat: print file and is connected to the standard output device
First, the command format:
cat [-AbeEnstTuv] [--help] [--version] filename
Second, the parameters:
-n or --number : 1 from the starting line number number all output.
-b or-nonblank --number : -n and similar, but not number blank lines.
-s or blank---squeeze : when faced with more than two successive blank lines, one line on the blank line substitution.
-v or-Nonprinting --show : Use M- ^ and symbols, in addition to outside LFD and TAB.
-E or-ends --show : display $ at the end of each line.
-T or-tabs --show : The TAB characters as ^ I.
-A , --show-All : equivalent to -vET.
-e : equivalent to "-vE" option;
-t : equivalent to "-vT" option;
Third, examples:
1. Print the file content:
cat textfile.txt
2. The content of the document textfile1 after input textfile2 with line numbers in this document:
cat –n textfile1 > textfile2
3. After the document content textfile1 and textfile2 plus line number (without blank lines) will be appended to the contents textfile3 documentation:
cat –b textfile1 textfile2 >> textfile3
4. Empty /etc/text.txt document content:
cat /dev/null > /etc/test.txt
5. The CAT also be used to create image files. For example, to make a floppy disk image file, put away the floppy disk enter:
cat /dev/fd0 > OUTFILE
6. Conversely, if you want to write the floppy disk image file, enter:
cat IMG_FILE > /DEV/FD0
7. reads data from the keyboard, create a new file or replace the existing file:
cat > file
8. The read data from the keyboard, append data to an existing file:
cat >> file
9. Copy files
cat <file1>file2
10. A combination of a plurality of files, each one screen is displayed results
cat file1 file2 file3 | less
11. A combination of a plurality of files, the output to a different file
cat file1 file2 file3 > file4
12. A combination of a plurality of files, the output conduit to pass another program
cat file1 file2 file3 | program