Deep usage of Linux cat

Source: Internet
Author: User

The order is based on the CENTOS6 series, and the translation is based on the official original meaning.


Cat-concatenatefiles and print on the standard output connection file and printout

Cat [OPTION] ... [FILE] ...

Description description

Concatenate FILE (s), or standard input,to standard output.


Equivalent To-vet


Number nonempty output lines

-e equivalent To-ve


Display $ at end of each line


Number all output lines


Suppress repeated empty outputlines

-T equivalent TO-VT


Display TAB characters as ^i

-U (ignored)


Use ^ and m-notation, except FORLFD and TAB

-a displays all and ends with a $ sign, equivalent to-vet, with low utility.

-B Displays all non-empty line numbers. That is, if it is a blank line, the line number is not displayed

-N Displays line numbers for all rows, including blank lines, etc., commonly used

-S compressed blank line, understood to encounter more than three lines of empty lines, only one row, chicken ribs parameter

Concatenate usage of cat:

To create or direct a file for the input content, format:

cat>>file<< XXX content xxx End

Of course, you can cat> or >>file directly.

Merging cat file1 file2 > File3


[]# Cat >>1.txt<<abc



[]# Cat>2.txt



[]# Cat 1.txt 2.txt



[]# cat 1.txt 2.txt > 3.txt

[]# Cat 3.txt



The above uses 2 different ways to create files and merge the content together.

Print standard output:

Cat+option+file will know Linux, not introduce

Summary: Cat is described in official info, and his usage is to connect and output file contents. It's just that very few people use it in the connection section. Most people only know cat print standard output. When you want to write a simple script, you can write it directly with Cat. Equivalent to an enhanced echo. Practical work is very practical.

Deep usage of Linux cat

Related Article

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: 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.