How do I append the output of a command to the end of a text file?
Use >>
instead of >
when directing output to a file:
your_command >> file_to_append_to
If file_to_append_to
does not exist, it will be created.
Example:
$ echo "hello" > file
$ echo "world" >> file
$ cat file
hello
world