This lesson shows that we can redirect the output of our Linux commands to a file instead of the terminal window.
If we have a command like:
The output is the list of files and folders in the current directory. If we instead want to send the output to a file we could use the followingg:
$ ls >out_file.txt
The list of files and folders is directed to a new file called out_file.txt. Note that all the same rules for paths still applies.
If we issued the command again, the old contents of the file would be overwritten. If we wanted to append the results to the end of the file instead of overwriting, we could do the following:
When we use >> instead of >, the results will be appended to the end of the file.