As you know, you can use shell to output information to the screen. However, if the output content is too large and redundant, it is not easy for us to analyze and extract the screen information we want, so how can I write shell output into a file?
The following two pipeline commands can be used:
1. > Symbol indicates writing information to a file
2.
> Symbol indicates adding information to an existing file
For example
The output of LS-L is as follows:
How can I write shell output to a file? Command: ls-L./test.txt (This indicates to write the LS-l command output to the test.txt file of the current directory)
This wayA test.txt file will be generated under the current directory to see if the information in the file is the same as the information output on the screen.
Similarly,> the same is true for the management belt command. It only writes information appended to an existing file.