1. Command function
tac is the reverse spelling function of cat is to display the contents of the file in reverse. cat is to read the file output from the first line of the file, tac is to read the file from the last line and reverse the output.
2. Grammar format
tac [option] [file]
Parameter Description
parameter |
Parameter Description |
-b |
Add a split flag at the beginning of the line instead of the end of the line |
-r |
Parse split flags as regular expressions |
-s |
Replace line with specified string as split flag |
3. Example of use
Example 1
[root@localhost test]# tac test.txt OK OK OK WELCOME TO LINUX HELLO WORLD