One day a Linux base command to view the contents of a file cat, TAC

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.