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.