Cat View text Files
1 , command format
Cat[option] ... [FILE] ...
2 , command functions
1. Display the file contents and create a new file cat>filename
2. Enter the content, after the content has been entered, use Ctrl+d to end the input
3. Merge several files into one file : Cat file1 file2 ... > file
3 , common parameters
- N : Add line number before input data
- b : Non-empty row output, and output line number
-e|-e : At the end of each line, add the following $
$ typically used for end -of-line endings
- S : Empty row does not repeat output
-t|-t : Line break appears as ^i
4 , common examples
1. View the contents of the file
Command: Cat/etc/issue
[Email protected]~]# cat/etc/issuecentosrelease 6.5 (Final) Kernel \ron an \m [email protected]~]#
2. Add content from issue to the end of the file
command: cat/etc/issue >> Test
[Email protected]~]# cat Test 123123123 [[email protected]~]# cat/etc/issue >> Test [email protected]~]# cat Test 123123123 centosrelease 6.5 (Final) Kernel \ron an \m [email protected]~]#
3. Display the number of lines in a file
command: cat-n Test
[[Email protected]~]# cat-n Test 1 123 2 123 3 123 4 5 centosrelease 6.5 (Final) 6 kernel\r on an \m 7 [[Email protected]~]#
4. use cat to enter content for new files
Cat>file[[email protected]~]# Cat >test1helloworld [[email protected]~]# cat Test1helloworld[[email protected]~] #
Tip: Use Cat Enter the contents of the file, when the contents of the file is completed, to use Ctrl+d End Input
Note:
TAC ( reverse list )
Command:
TAC Test1
Output:
[Email protected] ~]# TAC Test1worldhello[[email protected]~]#
Description:TACis toCatwrite it back, so his function is the same asCatinstead,Catis displayed continuously on the screen from the first line to the last row, andTACIt is the last line to the first line in reverse on the screen display!
This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1882091
One day a Linux base command to view the contents of a file cat, TAC