Cat command Overview

Source: Internet
Author: User

The Linux cat command is very convenient to read short files. If a file is very large, it is more convenient to use the page command. Next let's take a look at the practical application of the Linux cat command.

Usage of the Linux cat command: Use the cat command to view the file: $ CAT test. php;
$ Cat-n test. php: add the row number when viewing it;

The Linux cat command can also use the wildcard: $ cat-N *. php to display all PHP files (in sequence)
You can also do this: $ cat-n test. php test1.php test2.php; the results are exactly the same with the output results using wildcards.

You can use the Linux cat command and the redirection operator (>) To merge files:
$ Cat *. php> test3.php;

If there are two files, test. php and test1.php, how can we merge them? You can use the redirection operator (>)
$ CAT test. php> test1.php. In this way, test. php is merged to the end of test1.php. When merging, pay attention to the sequence, which cannot be wrong.
You can use the cat command to create a file and input the content directly to the file through the keyboard.
$ Cat> myfile. php
After the input is complete, press Ctrl + D to save and exit the file.

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.